Book Image

Bootstrap for Rails

By : Syed F Rahman
Book Image

Bootstrap for Rails

By: Syed F Rahman

Overview of this book

Table of Contents (18 chapters)
Bootstrap for Rails
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a progress bar


Progress bars are essential to show the progress of an action to the users. You can create attractive progress bars easily using Bootstrap's markup.

Here's the markup for a basic progress bar:

<div class="progress">
  <div class="progress-bar" style="width: 60%;"></div>
</div>

The progress bar should be wrapped inside a div element with the .progress class. This div element behaves as a container for the progress bar. The actual progress is shown using a child div element with the .progress-bar class. You can write a JavaScript code to change the CSS width of this element to see the transition of the progress bar.

The preceding progress bar looks like the following in a browser:

To add a label to the progress bar, you can add text inside the .progress-bar element. Take the text in the following code as an example:

<div class="progress">
  <div class="progress-bar" style="width: 60%;">60%</div>
</div>

This produces the percentage...