Open In App

Foundation CSS Flexbox Mode Sass Reference

Last Updated : 03 Nov, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Foundation CSS is an open-source and responsive front-end framework built by the ZURB foundation in September 2011, that makes it easy to lay out nice responsive websites, apps, and emails and can be accessible to any device.

Foundation CSS gives access to a lot of pre-built components, we can easily use them by adding helper classes to different elements. One of those UI components is FlexBox Mode. Flexbox mode replaces Foundation’s traditional method of using floats, vertical alignment, table cells, etc., with flexbox features and it helps us to create a website in an easier way.

Sass Reference:

 

Variable Used:

Name Type Default value Description
$flex-source-ordering-count Number 6 This variable is used to set the source order of flexbox.
$flexbox-responsive-to Boolean true This variable is used for quickly disabling/enabling Responsive breakpoints for Vanilla Flex Helpers.

Example 1: The following code demonstrates an example of source order.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- Foundation CSS CDN -->
    <link rel="stylesheet" href=
        crossorigin="anonymous">
    <link rel="stylesheet" href=
        crossorigin="anonymous">
    <link rel="stylesheet" href=
        crossorigin="anonymous">
  
    <link rel="stylesheet" href="style.css">
  
    <title>Foundation CSS Flexbox Mode</title>
  
    <style>
        .flex-container align-center margin-3 {
            display: flex;
        }
    </style>
</head>
  
<body>
    <h1 class="text-center" style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h3 class="text-center">
        Foundation CSS Flexbox Mode Sass Reference
    </h3>
  
    <div class="flex-container align-center margin-3" 
        style="background-color:#ccffcc;height:4rem">
        <div class="small-2 padding-1 " id="item1" 
            style="background-color:#ff4d00">
            GFG1
        </div>
        <div class="small-2 padding-1" id="item2" 
           style="background-color:#09d8ef">
           GFG2
        </div>
        <div class="small-2 padding-1" id="item3" 
             style="background-color:#2506eb">
            GFG3
        </div>
    </div>
</body>
</html>


Sass code:

$flex-source-ordering-count:2;

#item1{
    order:$flex-source-ordering-count;
}

Compiled CSS code:

#item1 {
    order: 2;
}

Output:

 

Example 2:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <!-- Foundation CSS CDN -->
    <link rel="stylesheet" href=
        crossorigin="anonymous">
    <link rel="stylesheet" href=
        crossorigin="anonymous">
    <link rel="stylesheet" href=
        crossorigin="anonymous">
  
    <link rel="stylesheet" href="style.css">
  
    <title>Foundation CSS Flexbox Mode</title>
  
    <style>
        .container{
            height: 500px;
            width: 100%;
            padding: 20px;
            margin-left: 250px;
            display: flex;
        }
    </style>
</head>
  
<body>
    <h1 class="text-center" style="color:green;">
        GeeksforGeeks
    </h1>
  
    <h3 class="text-center">
        Foundation CSS Flexbox Mode Sass Reference
    </h3>
      
    <div class="container">
        <div class="item" id="item-1">first box</div>
        <div class="item" id="item-2">second box</div>
        <div class="item" id="item-3">third box</div>
        <div class="item" id="item-4">fourth box</div>
        <div class="item" id="item-5">fifth box</div>
        <div class="item" id="item-6">sixth box</div>
    </div>
</body>
</html>


Sass code:

$flex-source-ordering-count:4;

.item{
    color: white;
    background-color: darkmagenta;
    border: 2px solid rgb(228, 214, 15);
    margin: 10px;
    padding: 5px;
    width: 100px;
    height: 100px;
}

#item-1{
    order:$flex-source-ordering-count;
}

Compiled CSS code:

.item {
  color: white;
  background-color: darkmagenta;
  border: 2px solid rgb(228, 214, 15);
  margin: 10px;
  padding: 5px;
  width: 100px;
  height: 100px;
}

#item-1 {
  order: 4;
}

Output:

 

Reference: https://get.foundation/sites/docs/flexbox-mode.html



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

Similar Reads