Foundation CSS Button Sizing
Last Updated :
10 Mar, 2022
Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails that look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is built on SaaS-like bootstrap. It is more sophisticated, flexible, and easily customizable. It also comes with CLI, so it’s easy to use it with module bundlers. It offers the Fastclick.js tool for faster rendering on mobile devices.
Buttons can be found everywhere on a webpage. They allow us to perform various operations with a simple click. Foundation CSS offers us a foundation-styled button. Sometimes, we may want to change the size and shape of the button. Foundation CSS allows us to change the button sizing by using various classes such as tiny, small, large, expanded.
Foundation CSS Button Sizing Classes:
- tiny: Makes the size and shape of the button tiny
- small: Makes the size and shape of the button small
- large: Makes the size and shape of the button large
- expanded: Expands the size and shape of the button
Syntax:
<a class="button button-sizing-class" href="link">Button</a>
Example 1: In the below example, we have created various sized buttons utilizing all the button sizing classes.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Foundation CSS Button Sizing</title>
<link rel="stylesheet"
href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/foundation.min.css"
crossorigin="anonymous"/>
<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/foundation.min.js"
crossorigin="anonymous">
</script>
<link rel="stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js">
</script>
</head>
<body
class="grid-x align-middle align-center grid-container"
style="height: 95vh; width: 95vw">
<div>
<h2 style="color: green">GeekforGeeks</h2>
<h4>Foundation CSS Button Sizing</h4>
<a class="button tiny" href="#">
Tiny Button
</a>
<a class="button small" href="#">
Small Button
</a>
<a class="button" href="#"
>Default Button
</a>
<a class="button large" href="#">
Large Button
</a>
<a class="button expanded" href="#">
Expanded Button
</a>
<a class="button small expanded" href="#">
Small Expanded Button
</a>
</div>
<script>
$(document).ready(function () {
$(document).foundation();
});
</script>
</body>
</html>
Output:
Foundation CSS Button Sizing
Foundation CSS also gives us the option to create buttons that expand responsively. By adding the Foundation CSS stylesheet mentioned here, to our document, we have access to the responsive expanded classes.
Foundation CSS Responsive Expanded classes:
- small-only-expanded: Expands the size and shape of the button only on smaller-sized screens.
- medium-only-expanded: Expands the size and shape of the button only on medium-sized screens.
- large-only-expanded: Expands the size and shape of the button only on large-sized screens.
- medium-expanded: Expands the size and shape of the button on medium and large-sized screens.
- large-expanded: Expands the size and shape of the button on larger-sized screens.
- medium-down-expanded: Expands the size and shape of the button on medium and small-sized screens.
- large-down-expanded: Expands the size and shape of the button on large and small-sized screens.
Syntax:
<a class="button responsive-expanded-button-class" href="link">Button</a>
Example 2: In the below example, we have created various responsive expanded buttons.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<title>Foundation CSS Button Sizing</title>
<link rel="stylesheet"
href=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/css/foundation.min.css"
crossorigin="anonymous"/>
<script src=
"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/foundation.min.js"
crossorigin="anonymous">
</script>
<link rel="stylesheet"
href=
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/>
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/foundation/6.0.1/js/vendor/jquery.min.js">
</script>
<style>
@media screen and (max-width: 39.9375em) {
.button.small-only-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
@media screen and (min-width: 40em) and (max-width: 63.9375em) {
.button.medium-only-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
@media screen and (max-width: 63.9375em) {
.button.medium-down-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
@media print, screen and (min-width: 40em) {
.button.medium-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
@media screen and (min-width: 64em) and (max-width: 74.9375em) {
.button.large-only-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
@media screen and (max-width: 74.9375em) {
.button.large-down-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
@media print, screen and (min-width: 64em) {
.button.large-expanded {
display: block;
width: 100%;
margin-right: 0;
margin-left: 0;
}
}
</style>
</head>
<body class="grid-x align-middle
align-center grid-container"
style="height: 95vh; width: 95vw" >
<div>
<h2 style="color: green">GeekforGeeks</h2>
<h4>Foundation CSS Button Sizing</h4>
<a class="button small-only-expanded"
href="#">
Expands only on small screens
</a>
<a class="button medium-only-expanded"
href="#">
Expands only on medium screens
</a>
<a class="button large-only-expanded"
href="#">
Expands only on large screens
</a>
<a class="button medium-expanded"
href="#">
Expands on medium and larger screens
</a>
<a class="button large-expanded"
href="#">
Expands on large and larger screens
</a>
<a class="button medium-down-expanded"
href="#">
Expands on medium and smaller screens
</a>
<a class="button large-down-expanded"
href="#">
Expands on large and smaller screens
</a>
</div>
<script>
$(document).ready(function () {
$(document).foundation();
});
</script>
</body>
</html>
Output:
Foundation CSS Button Sizing
Reference: https://get.foundation/sites/docs/button.html#sizing
Similar Reads
Non-linear Components
In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co
11 min read
JavaScript Tutorial
JavaScript is a programming language used to create dynamic content for websites. It is a lightweight, cross-platform, and single-threaded programming language. JavaScript is an interpreted language that executes code line by line, providing more flexibility.JavaScript on Client Side : On client sid
11 min read
Web Development
Web development is the process of creating, building, and maintaining websites and web applications. It involves everything from web design to programming and database management. Web development is generally divided into three core areas: Frontend Development, Backend Development, and Full Stack De
5 min read
Class Diagram | Unified Modeling Language (UML)
A UML class diagram is a visual tool that represents the structure of a system by showing its classes, attributes, methods, and the relationships between them. It helps everyone involved in a projectâlike developers and designersâunderstand how the system is organized and how its components interact
12 min read
Steady State Response
In this article, we are going to discuss the steady-state response. We will see what is steady state response in Time domain analysis. We will then discuss some of the standard test signals used in finding the response of a response. We also discuss the first-order response for different signals. We
9 min read
Spring Boot Tutorial
Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance
10 min read
React Interview Questions and Answers
React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications
15+ min read
JavaScript Interview Questions and Answers
JavaScript (JS) is the most popular lightweight, scripting, and interpreted programming language. JavaScript is well-known as a scripting language for web pages, mobile apps, web servers, and many other platforms. Both front-end and back-end developers need to have a strong command of JavaScript, as
15+ min read
Backpropagation in Neural Network
Back Propagation is also known as "Backward Propagation of Errors" is a method used to train neural network . Its goal is to reduce the difference between the modelâs predicted output and the actual output by adjusting the weights and biases in the network.It works iteratively to adjust weights and
9 min read
React Tutorial
React is a JavaScript Library known for front-end development (or user interface). It is popular due to its component-based architecture, Single Page Applications (SPAs), and Virtual DOM for building web applications that are fast, efficient, and scalable.Applications are built using reusable compon
8 min read