Foundation CSS Progress Bar Sass Reference
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.
A progress bar is used to display the progress of a process. A progress bar helps us to visualize how much of the process is complete and how much is left. We can add a progress bar on a web page using predefined Foundation CSS classes. To add a progress bar using Foundation CSS, we use the “progress” class to create a progress container and the n class to create a progress bar.
Variable Used:
Variable-Name | Description | Type | Default Value |
---|---|---|---|
$meter-height | This variable is used to define the height of an <meter> element. | Length | 1 rem |
$meter-radius | This variable is used to define the border radius of an <meter> element. | Length | $global-radius |
$meter-background | This variable is used to define the background color of an <meter> element. | Color | $medium-gray |
$meter-fill-good | This variable is used to define the meter fill for an optimal value in an <meter> element. | Color | $success-color |
$meter-fill-medium | This variable is used to define the meter fill for an average value in an <meter> element. | Color | $warning-color |
$meter-fill-bad | This variable is used to define the meter fill for a suboptimal value in an <meter> element. | Color | $alert-color |
$progress-height | This variable is used to define the height of a progress bar. | Number | 1 rem |
$progress-background | This variable is used to define the background color of a progress bar. | Color | $medium-gray |
$progress-margin-bottom | This variable is used to define the bottom margin of a progress bar. | Number | $global-margin |
$progress-meter-background | This variable is used to define the default color of a progress bar’s meter. | Color | $primary-color |
$progress-radius | This variable is used to define the default radius of a progress bar. | Number | $global-radius |
Example 1: In the below code, we will make use of the above variable to demonstrate the use of the Progress Bar.
HTML
<!DOCTYPE html> < html > < head > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width,initial-scale=1" > <!-- Compressed CSS --> < link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/css/foundation.min.css" > < link rel = "stylesheet" href = "style.css" > < title >w3wiki</ title > <!-- font-awesome cdn --> < script src = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/js/all.min.js' > </ script > </ head > < body > < center > < h1 class = "title" style = "color:green;" > w3wiki </ h1 > < h3 class = "subtitle" > A computer science portal for Beginner </ h3 > < div class = "gfg" > < div class = "progress" > < div class = "progress-meter" style = "width:60%" >GfG</ div > </ div > </ div > </ center > </ body > </ html > |
SASS Code:
$meter-height:100px; .progress{ height:$meter-height; } .progress-meter{ height:$meter-height; }
Compiled CSS Code:
.progress { height: 100px; } .progress-meter { height: 100px; }
Output:
Example 2: In the below code, we will make use of the above variable to demonstrate the use of the Progress Bar.
HTML
<!DOCTYPE html> < html > < head > < meta charset = "utf-8" > < meta name = "viewport" content = "width=device-width,initial-scale=1" > <!-- Compressed CSS --> < link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/css/foundation.min.css" > < link rel = "stylesheet" href = "style.css" > < title >w3wiki</ title > <!-- font-awesome cdn --> < script src = 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0-2/js/all.min.js' > </ script > </ head > < body > < center > < h1 class = "title" style = "color:green;" > w3wiki </ h1 > < h3 class = "subtitle" > A computer science portal for Beginner </ h3 > < div class = "gfg" > < div class = "progress" style = "height:auto;" > < div class = "progress-meter" style = "width:60%" > GfG </ div > </ div > </ div > </ center > </ body > </ html > |
SASS Code:
$meter-background:green; .progress-meter{ background-color:$meter-background; }
Compiled CSS Code:
.progress-meter { background-color: green; }
Output:
Reference: https://get.foundation/sites/docs/progress-bar.html
Contact Us