Open In App

Foundation CSS Progress Bar with Text

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. It helps us to visualize how much of the process is complete and how much is left. For this, the percentage is used to display the amount of completion.



Foundation CSS Progress Bar with Text classes:

Foundation CSS Progress Bar Class attributes:



Syntax:

<div class="progress" role="progressbar">
    <span class="progress-meter">
        <span class="progress-meter-text">Percentage</span>
    </span>
</div>

Example 1: Basic example illustrating a progress bar with text in Foundation CSS.




<!DOCTYPE html>
<html lang="en">
  
<head>
    <title>Foundation CSS Progress Bar with Text</title>
    <link rel="stylesheet" 
          href=
          crossorigin="anonymous">
    <title>
        Foundation CSS Progress Bar with Text
    </title>
</head>
  
<body class="grid-container">
    <h2>GeeksforGeeks</h2>
    <h4>Foundation CSS Progress Bar with Text </h4>
    <div class="success progress" 
         role="progressbar" 
         aria-valuenow="50" 
         aria-valuemin="0" 
         aria-valuetext="50 percent" 
         aria-valuemax="100" 
         style="margin-top: 50px;"
        <span class="progress-meter" 
              style="width: 50%">
            <span class="progress-meter-text">50%</span
        </span>
    </div>
</body>
  
</html>

Output:

A Basic progress bar with text

Example 2: This example describes the animated progress bar with text in Foundation CSS.




<!DOCTYPE html>
<html lang="en">
  
<head>
    <title>Foundation CSS Progress Bar with Text</title>
    <link rel="stylesheet" 
          href=
          crossorigin="anonymous">
    <script src=
          crossorigin="anonymous">
    </script>
    <title>Foundation CSS Progress Bar with Text</title>
</head>
  
<body class="grid-container">
    <h2>GeeksforGeeks</h2>
    <h4>Foundation CSS Animated Progress Bar with Text </h4>
    <div class="success progress" 
         role="progressbar" 
         aria-valuenow="50" 
         aria-valuemin="0" 
         aria-valuetext="50 percent" 
         aria-valuemax="100"
        <span class="progress-meter" style="width: 50%">
            <span class="progress-meter-text">50%</span>
        </span>
    </div>
    <script>
        const recur = () => {
            let value = 0;
            const progressBar = document.querySelector(".progress");
            const progressMeter = document.querySelector(".progress-meter");
            const progressText = document.querySelector(".progress-meter-text");
            setInterval(() => {
                progressBar.ariaValueNow = value;
                progressBar.ariaValueText = value + "percent";
                progressMeter.style.width = value + "%";
                progressText.innerHTML = value + "%";
                value = (value + 1) % 100;
                console.log(value)
            }, 50)
        }
        recur();
    </script>
</body>
  
</html>

Output:

An animated progress bar with text

References: https://get.foundation/sites/docs/progress-bar.html#with-text


Article Tags :