Open In App

Foundation CSS Button Group Sass Reference

Last Updated : 19 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Foundation CSS is an open-source and 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 and 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.

Foundation CSS offers us a button group where buttons of identical nature can be grouped. Foundation CSS allows the buttons in the button group to be stacked upon each vertically using the stacked class. Let’s have a look at how to achieve it.

Variable Used: 

Variable-Name Description Type Default-Value
$buttongroup-margin  This variable is used to define the margin for button groups.  Number  1rem
$buttongroup-spacing  This variable is used to define the margin between buttons in a button group. Number 1px
$buttongroup-child-selector  This variable is used to define the selector for the buttons inside a button group. String ‘.button’ 
$buttongroup-expand-max  This variable is used to define the Maximum number of buttons that can be in an even-width button group.  Number
$buttongroup-radius-on-each  This variable is used to determine if $button-radius is applied to each button or the button group as a whole.  Boolean true 

 

Example 1: In the below code, we will make use of the above variable to demonstrate the use of the button group.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <title>GeeksforGeeks</title>
    <link rel="stylesheet" href="style.css">
          
    <link rel="stylesheet" href=
        crossorigin="anonymous">
</head>
  
<body style="margin:15px">
  
    <center>
        <h1 style="color:green;" style="margin-left:950px;">
            GeeksforGeeks
        </h1>
        <h3>A computer science portal for geeks</h3>
           
        <div class="button-group" style="margin-left:350px;">
            <a class="button">GfG1</a>
            <a class="button">GfG2</a>
            <a class="button">GfG3</a>
        </div>            
    </center>
</body>
</html>


SASS Code:

$buttongroup-margin : 1rem;
.button-group {
   margin:$buttongroup-margin;
}

Compiled CSS Code:

.button-group {
    margin: 1rem;
 }

Output:

 

Example 2: In the below code, we will make use of the above variable to demonstrate the use of the button group.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <title>GeeksforGeeks</title>
    <link rel="stylesheet" href="style.css">
          
    <link rel="stylesheet" href=
        crossorigin="anonymous">
</head>
  
<body style="margin:15px">
    <center>
        <h1 style="color:green;" style="margin-left:950px;">
            GeeksforGeeks
        </h1>
        <h3>A computer science portal for geeks</h3>
           
        <div class="button-group" style="margin-left:350px;">
            <a class="button">GfG1</a>
            <a class="button">GfG2</a>
            <a class="button">GfG3</a>
        </div>           
    </center>
</body>
</html>


SASS Code:

$buttongroup-spacing: 1px;
.button {
    padding:$buttongroup-spacing;
}

Compiled CSS Code:

.button {
    padding: 1px; 
}

Output:

 

Reference: https://get.foundation/sites/docs/button-group.html



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads