BootStrap

images-2

Submitted  by : Engineer  Farid  Osuli(Afghan)

Facebook: Farid Osuli      , linked.com :Egineer Farid Osuli

Email Addr: faridisolisheena@yahoo.com

 

 

What is Bootstrap?

  •  Bootstrap is a free front-end framework for faster and easier web development
  • Bootstrap includes HTML and CSS based design templates for typography, forms, buttons, tables, navigation, modals, image carousels and many other, as well as optional JavaScript plugins
  • Bootstrap also gives you the ability to easily create responsive designs
What is Responsive Web Design?

Responsive web design is about creating web sites which automatically adjust themselves to look good on all devices, from small phones to large desktops.

Bootstrap History

Bootstrap was developed by Mark Otto and Jacob Thornton at Twitter, and released as an open source product in August 2011 on GitHub.

In June 2014 Bootstrap was the No.1 project on GitHub!

Why Use Bootstrap?

Advantages of Bootstrap:

  • Easy to use: Anybody with just basic knowledge of HTML and CSS can start using Bootstrap
  • Responsive features: Bootstrap’s responsive CSS adjusts to phones, tablets, and desktops
  • Mobile-first approach: In Bootstrap 3, mobile-first styles are part of the core framework
  • Browser compatibility: Bootstrap is compatible with all modern browsers (Chrome, Firefox, Internet Explorer, Safari, and Opera)

Where to Get Bootstrap?

There are two ways to start using Bootstrap on your own web site.

You can:

  • Download Bootstrap from getbootstrap.com
  • Include Bootstrap from a CDN

Downloading Bootstrap

If you want to download and host Bootstrap yourself, go to getbootstrap.com, and follow the instructions there.

Bootstrap CDN

If you don’t want to download and host Bootstrap yourself, you can include it from a CDN (Content Delivery Network).

MaxCDN provide CDN support for Bootstrap’s CSS and JavaScript. Also include jQuery:

MaxCDN:

<!– Latest compiled and minified CSS –>
<link rel=”stylesheet” href=”http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css”&gt;

<!– jQuery library –>

<!– Latest compiled JavaScript –>

One advantage of using the Bootstrap CDN:
Many users already have downloaded Bootstrap from MaxCDN when visiting another site. As a result, it will be loaded from cache when they visit your site, which leads to faster loading time. Also, most CDN’s will make sure that once a user requests a file from it, it will be served from the server closest to them, which also leads to faster loading time.

Create First Web Page With Bootstrap

  1. Add the HTML5 doctype

Bootstrap uses HTML elements and CSS properties that require the HTML5 doctype.

Always include the HTML5 doctype at the beginning of the page, along with the lang attribute and the correct character set:

<!DOCTYPE html>
<html lang=”en”>
<head>
<meta charset=”utf-8″>
</head>
</html>

  1. Bootstrap 3 is mobile-first

Bootstrap 3 is designed to be responsive to mobile devices. Mobile-first styles are part of the core framework.

To ensure proper rendering and touch zooming, add the following <meta> tag inside the <head> element:

<meta name=”viewport” content=”width=device-width, initial-scale=1″>

The width=device-width part sets the width of the page to follow the screen-width of the device (which will vary depending on the device).

The initial-scale=1 part sets the initial zoom level when the page is first loaded by the browser.

  1. Containers

Bootstrap also requires a containing element to wrap site contents.

There are two container classes to choose from:

  1. The .container class provides a responsive fixed width container
  2. The .container-fluid class provides a full width container, spanning the entire width of the viewport

Note: Containers are not nestable (you cannot put a container inside another container).

Two Basic Bootstrap Pages

The following example shows the code for a basic Bootstrap page (with a responsive fixed width container):

Example

<!DOCTYPE html>
<html lang=”en”>
<head>
<title>Bootstrap Example</title>
<meta charset=”utf-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css”&gt;

</head>
<body>

My First Bootstrap Page

This is some text.

</body>
</html>
Try it Yourself »

The following example shows the code for a basic Bootstrap page (with a full width container):

Example

<!DOCTYPE html>
<html lang=”en”>
<head>
<title>Bootstrap Example</title>
<meta charset=”utf-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<link rel=”stylesheet” href=”http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css”&gt;

</head>
<body>

My First Bootstrap Page

This is some text.

</body>
</html>

 

 

 

Bootstrap Grids

Bootstrap Grid System

Bootstrap’s grid system allows up to 12 columns across the page.

If you do not want to use all 12 column individually, you can group the columns together to create wider columns:

span 1 span 1 span 1 span 1 span 1 span 1 span 1 span 1 span 1 span 1 span 1 span 1
 span 4  span 4  span 4
span 4 span 8
span 6 span 6
span 12

Bootstrap’s grid system is responsive, and the columns will re-arrange automatically depending on the screen size.

Grid Classes

The Bootstrap grid system has four classes:

  • xs (for phones)
  • sm (for tablets)
  • md (for desktops)
  • lg (for larger desktops)

The classes above can be combined to create more dynamic and flexible layouts.

Basic Structure of a Bootstrap Grid

The following is a basic structure of a Bootstrap grid:

</div>

</div>

First; create a row (

). Then, add the desired number of columns (tags with appropriate .col-*-*classes). Note that numbers in .col-*-* should always add up to 12 for each row.

Below we have collected some examples of basic Bootstrap grid layouts.

Three Equal Columns

.col-sm-4

.col-sm-4

.col-sm-4

The following example shows how to get a three equal-width columns starting at tablets and scaling to large desktops. On mobile phones, the columns will automatically stack:

Example

.col-sm-4
.col-sm-4
.col-sm-4

</div>

 

Two Unequal Columns

.col-sm-4

.col-sm-8

The following example shows how to get two various-width columns starting at tablets and scaling to large desktops:

Example

.col-sm-4
.col-sm-8

</div>

 

Bootstrap Text/Typography

Bootstrap’s Default Settings

Bootstrap’s global default font-size is 14px, with a line-height of 1.428.

This is applied to the <body> and all paragraphs.

In addition, all <p> elements have a bottom margin that equals half their computed line-height (10px by default).

Bootstrap vs. Browser Defaults

In this chapter, we will look at some HTML elements that will be styled a little bit different by Bootstrap than browser defaults.

<h1> – <h6>

By default, Bootstrap will style the HTML headings (<h1> to <h6>) in the following way:

Example

h1 Bootstrap heading (36px)

h2 Bootstrap heading (30px)

h3 Bootstrap heading (24px)

h4 Bootstrap heading (18px)

h5 Bootstrap heading (14px)
h6 Bootstrap heading (12px)

 

<small>

In Bootstrap the HTML <small> element is used to create a lighter, secondary text in any heading:

Example

h1 heading secondary text

h2 heading secondary text

h3 heading secondary text

h4 heading secondary text

h5 heading secondary text
h6 heading secondary text

 

<mark>

Bootstrap will style the HTML <mark> element in the following way:

Example

Use the mark element to highlight text.

<abbr>

Bootstrap will style the HTML <abbr> element in the following way:

Example

The WHO was founded in 1948.

 

<blockquote>

Bootstrap will style the HTML <blockquote> element in the following way:

Example

For 50 years, WWF has been protecting the future of nature. The world’s leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.

From WWF’s website

 

To show the quote on the right, use the .blockquote-reverse class:

Example

For 50 years, WWF has been protecting the future of nature. The world’s leading conservation organization, WWF works in 100 countries and is supported by 1.2 million members in the United States and close to 5 million globally.

From WWF’s website

 

<dl>

Bootstrap will style the HTML <dl> element in the following way:

Example

Coffee

– black hot drink

Milk

– white cold drink
Try it Yourself »

<code>

Bootstrap will style the HTML <code> element in the following way:

Example

The following HTML elements: span, section, and div defines a section in a document.
Try it Yourself »

<kbd>

Bootstrap will style the HTML <kbd> element in the following way:

Example

Use ctrl + p to open the Print dialog box.
Try it Yourself »

<pre>

Bootstrap will style the HTML <pre> element in the following way:

Example

Text in a pre elementis displayed in a fixed-widthfont, and it preservesboth      spaces andline breaks.
Try it Yourself »

Contextual Colors and Backgrounds

Bootstrap also has some contextual classes that can be used to provide “meaning through colors”.

The classes for text colors are:.text-muted, .text-primary, .text-success, .text-info, .text-warning, and.text-danger:

Example

This text is muted.

This text is important.

This text indicates success.

This text represents some information.

This text represents a warning.

This text represents danger.
Try it Yourself »

The classes for background colors are:.bg-primary, .bg-success, bg-info, bg-warning, and .bg-danger:

Example

This text is important.

This text indicates success.

This text represents some information.

This text represents a warning.

This text represents danger.
Try it Yourself »

More Typography Classes

The Bootstrap classes below can be added to style HTML elements further:

Class Description Example
.lead Makes a paragraph stand out Try it
.small Indicates smaller text (set to 85% of the size of the parent) Try it
.text-left Indicates left-aligned text Try it
.text-center Indicates center-aligned text Try it
.text-right Indicates right-aligned text Try it
.text-justify Indicates justified text Try it
.text-nowrap Indicates no wrap text Try it
.text-lowercase Indicates lowercased text Try it
.text-uppercase Indicates uppercased text Try it
.text-capitalize Indicates capitalized text Try it
.initialism Displays the text inside an <abbr> element in a slightly smaller font size Try it
.list-unstyled Removes the default list-style and left margin on list items (works on both <ul> and <ol>). This class only applies to immediate children list items (to remove the default list-style from any nested lists, apply this class to any nested lists as well) Try it
.list-inline Places all list items on a single line Try it
.dl-horizontal Lines up the terms (<dt>) and descriptions (<dd>) in <dl> elements side-by-side. Starts off like default <dl>s, but when the browser window expands, it will line up side-by-side Try it
.pre-scrollable Makes a <pre> element scrollable Try it

Complete Bootstrap Typography Reference

For a complete reference of all typography elements/classes, go to our complete Bootstrap Typography Reference.

Also look at our Bootstrap Helper Classes Reference for more information about contextual classes.

 

Bootstrap Tables

« Previous

Next Chapter »

Bootstrap Basic Table

A basic Bootstrap table has a light padding and only horizontal dividers.

The .table class adds basic styling to a table:

Example

Firstname Lastname Email
John Doe john@example.com
Mary Moe mary@example.com
July Dooley july@example.com

Try it Yourself »

Striped Rows

The .table-striped class adds zebra-stripes to a table:

Example

Firstname Lastname Email
John Doe john@example.com
Mary Moe mary@example.com
July Dooley july@example.com

Try it Yourself »

Bordered Table

The .table-bordered class adds borders on all sides of the table and cells:

Example

Firstname Lastname Email
John Doe john@example.com
Mary Moe mary@example.com
July Dooley july@example.com

Try it Yourself »

Hover Rows

The .table-hover class enables a hover state on table rows:

Example

Firstname Lastname Email
John Doe john@example.com
Mary Moe mary@example.com
July Dooley july@example.com

Try it Yourself »

Condensed Table

The .table-condensed class makes a table more compact by cutting cell padding in half:

Example

Firstname Lastname Email
John Doe john@example.com
Mary Moe mary@example.com
July Dooley july@example.com

Try it Yourself »

Contextual Classes

Contextual classes can be used to color table rows (<tr>) or table cells (<td>):

Example

Firstname Lastname Email
John Doe john@example.com
Mary Moe mary@example.com
July Dooley july@example.com

Try it Yourself »

The contextual classes that can be used are:

Class Description
.active Applies the hover color to the table row or table cell
.success Indicates a successful or positive action
.info Indicates a neutral informative change or action
.warning Indicates a warning that might need attention
.danger Indicates a dangerous or potentially negative action

Bootstrap Images

« Previous

Next Chapter »

Bootstrap Image Shapes

Rounded Corners:

Circle:

Thumbnail:

Rounded Corners

The .img-rounded class adds rounded corners to an image (IE8 do not support rounded corners):

Example

<img src=”cinqueterre.jpg” class=”img-rounded” alt=”Cinque Terre” width=”304″ height=”236″>
Try it Yourself »

Circle

The .img-circle class shapes the image to a circle (IE8 do not support rounded corners):

Example

<img src=”cinqueterre.jpg” class=”img-circle” alt=”Cinque Terre” width=”304″ height=”236″>
Try it Yourself »

Thumbnail

The .img-thumbnail class shapes the image to a thumbnail:

Example

<img src=”cinqueterre.jpg” class=”img-thumbnail” alt=”Cinque Terre” width=”304″ height=”236″>
Try it Yourself »

Responsive Images

Images comes in all sizes. So do screens. Responsive images automatically adjust to fit the size of the screen.

Create responsive images by adding an .img-responsive class to the <img> tag. The image will then scale nicely to the parent element.

The .img-responsive class applies max-width: 100%; and height: auto; to the image:

Example

<img class=”img-responsive” src=”img_chania.jpg” alt=”Chania”>
Try it Yourself »

Image Gallery

You can also use Bootstrap’s grid system in conjunction with the .thumbnail class to create an image gallery:

Example

</div>
Try it Yourself »

Responsive Embeds

Also let videos or slideshows scale properly on any device.

Classes can be applied directly to , , , and elements.

The following example creates a responsive video by adding an .embed-responsive-item class to an  tag (the video will then scale nicely to the parent element). The containing 

 defines the aspect ratio of the video:

Example

</div>
Try it Yourself »

What is aspect ratio?

The aspect ratio of an image describes the proportional relationship between its width and its height. Two common video aspect ratios are 4:3 (the universal video format of the 20th century), and 16:9 (universal for HD television and European digital television).

You can choose between two aspect ratio classes:

<!– 16:9 aspect ratio –>

<!– 4:3 aspect ratio –>

 

 

Bootstrap Jumbotron and Page Header

« Previous

Next Chapter »

Creating a Jumbotron

A jumbotron indicates a big box for calling extra attention to some special content or information.

A jumbotron is displayed as a grey box with rounded corners. It also enlarges the font sizes of the text inside it.

Tip: Inside a jumbotron you can put nearly any valid HTML, including other Bootstrap elements/classes.

Use a 

 element with class .jumbotron to create a jumbotron:

Bootstrap Tutorial

Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile-first projects on the web.

Jumbotron Inside Container

Place the jumbotron inside the 

 if you want the jumbotron to NOT extend to the edge of the screen:

Example

Bootstrap Tutorial

Bootstrap is the most popular HTML, CSS, and JS framework for developing
responsive, mobile-first projects on the web.

<p>This is some text.</p>
<p>This is another text.</p>
</div>
Try it Yourself »

Jumbotron Outside Container

Place the jumbotron outside the 

 if you want the jumbotron to extend to the screen edges:

Example

Bootstrap Tutorial

Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive,
mobile-first projects on the web.

This is some text.

This is another text.

Try it Yourself »

Creating a Page Header

A page header is like a section divider.

The .page-header class adds a horizontal line under the heading (+ adds some extra space around the element):

Example Page Header

Use a 

 element with class .page-header to create a page header:

Example

Example Page Header

 

Bootstrap Wells

« Previous

Next Chapter »

Wells

The .well class adds a rounded border around an element with a gray background color and some padding:

Basic Well

Example

Basic Well

Try it Yourself »

Well Size

Small Well

Normal Well

Large Well

Change the size of the well by adding the .well-sm class for small wells or  .well-lg class for large wells:

Example

Small Well
Large Well

 

Bootstrap Alerts

« Previous

Next Chapter »

Alerts

Bootstrap provides an easy way to create predefined alert messages:

×Success! This alert box indicates a successful or positive action.

×Info! This alert box indicates a neutral informative change or action.

×Warning! This alert box indicates a warning that might need attention.

×Danger! This alert box indicates a dangerous or potentially negative action.

Alerts are created with the .alert class, followed by one of the four contextual classes .alert-success, .alert-info, .alert-warning or .alert-danger:

Example

Success! Indicates a successful or positive action.
Info! Indicates a neutral informative change or action.
Warning! Indicates a warning that might need attention.
Danger! Indicates a dangerous or potentially negative action.

Try it Yourself »

Closing Alerts

To close the alert message, add class=”close” and data-dismiss=”alert” to a link or a button element:

Example

×
Success! Indicates a successful or positive action.

Try it Yourself »

The aria-* attribute and &times; explanation

To help improve accessibility for people using screen readers, you should include the aria-label=”close” attribute, when creating a close button.

&times; (×) is an HTML entity that is the preferred icon for close buttons, rather than the letter “x”.

Animated Alerts

The .fade and .in classes adds a fading effect when closing the alert message:

Example

 

Bootstrap Buttons

« Previous

Next Chapter »

Button Styles

Bootstrap provides seven styles of buttons:

Default Primary Success Info Warning Danger Link

To achieve the button styles above, Bootstrap has the following classes:

  • .btn-default
  • .btn-primary
  • .btn-success
  • .btn-info
  • .btn-warning
  • .btn-danger
  • .btn-link

The following example shows the code for the different button styles:

Example

Default
Primary
Success
Info
Warning
Danger
Link
Try it Yourself »

The button classes can be used on an , , or  element:

Example

Link Button
Button

Try it Yourself »

Why do we put a # in the href attribute of the link?

Since we do not have any page to link it to, and we do not want to get a “404” message, we put # as the link. In real life it should of course been a real URL to the “Search” page.

Button Sizes

Bootstrap provides four button sizes:

Large Medium Small XSmall

The classes that define the different sizes are:

  • .btn-lg
  • .btn-md
  • .btn-sm
  • .btn-xs

The following example shows the code for different button sizes:

Example

Large
Medium
Small
XSmall
Try it Yourself »

Block Level Buttons

A block level button spans the entire width of the parent element.

Button 1Button 2

Add class .btn-block to create a block level button:

 

 

 

Bootstrap Button Groups

« Previous

Next Chapter »

Button Groups

Bootstrap allows you to group a series of buttons together (on a single line) in a button group:

AppleSamsungSony

Use a 

 element with class .btn-group to create a button group:

Example

Apple
Samsung
Sony

Try it Yourself »

Tip: Instead of applying button sizes to every button in a group, use class .btn-group-* to size all buttons in the group:

Example

Apple
Samsung
Sony

Try it Yourself »

Vertical Button Groups

Bootstrap also supports vertical button groups:

AppleSamsungSony

Use the class .btn-group-vertical to create a vertical button group:

Example

Apple
Samsung
Sony

Try it Yourself »

Justified Button Groups

To span the entire width of the screen, use the .btn-group-justified class:

Apple

Samsung

Sony

Example with <a> elements:

Example

Try it Yourself »

Note: For <button> elements, you must wrap each button in a .btn-group class:

Example

Apple
Samsung
Sony

</div>
Try it Yourself »

Nesting Button Groups & Dropdown Menus

AppleSamsung

Sony

Nest button groups to create dropdown menus:

Example

Apple
Samsung

</div>
Try it Yourself »

Split Button Dropdowns

Sony

Example

 

Bootstrap Glyphicons

« Previous

Next Chapter »

Glyphicons

Bootstrap provides 200 glyphicons from the Glyphicons Halflings set.

Glyphicons can be used in text, buttons, toolbars, navigation, forms, etc.

Here are some examples of glyphicons:

Envelope glyphicon:

Print glyphicon:

Search glyphicon:

Download glyphicon:

Glyphicon Syntax

A glyphicon is inserted with the following syntax:

<span class=”glyphicon glyphicon-name“></span>

The name part in the syntax above must be replaced with the proper name of the glyphicon.

Glyphicon Example

The following example shows different ways to use glyphicons:

Example

<p>Envelope icon: <span class=”glyphicon glyphicon-envelope”></span></p>
<p>Envelope icon as a link:
<a href=”#”><span class=”glyphicon glyphicon-envelope”></span></a>
</p>
<p>Search icon: <span class=”glyphicon glyphicon-search”></span></p>
<p>Search icon on a button:
<button type=”button” class=”btn btn-default”>
<span class=”glyphicon glyphicon-search”></span> Search
</button>
</p>
<p>Search icon on a styled button:
<button type=”button” class=”btn btn-info”>
<span class=”glyphicon glyphicon-search”></span> Search
</button>
</p>
<p>Print icon: <span class=”glyphicon glyphicon-print”></span></p>
<p>Print icon on a styled link button:
<a href=”#” class=”btn btn-success btn-lg”>
<span class=”glyphicon glyphicon-print”></span> Print
</a>
</p>

 

 

Bootstrap Badges and Labels

« Previous

Next Chapter »

Badges

Badges are numerical indicators of how many items are associated with a link:

News 5
Comments 10
Updates 2

The numbers (5, 10, and 2) are the badges.

Use the .badge class within <span> elements to create badges:

Example

<a href=”#”>News <span class=”badge”>5</span></a><br>
<a href=”#”>Comments <span class=”badge”>10</span></a><br>
<a href=”#”>Updates <span class=”badge”>2</span></a>
Try it Yourself »

Badges can also be used inside other elements, such as buttons:

Primary 7

The following example shows how to add badges to buttons:

Example

<button type=”button” class=”btn btn-primary”>Primary <span class=”badge”>7</span></button>
Try it Yourself »

Labels

Labels are used to provide additional information about something:

Example New

Example New

Example New

Example New

Example New
Example New

Use the .label class,  followed by one of the six contextual classes .label-default, .label-primary, .label-success, .label-info, .label-warning or .label-danger, within a <span> element to create a label:

Example

<h1>Example <span class=”label label-default”>New</span></h1>
<h2>Example <span class=”label label-default”>New</span></h2>
<h3>Example <span class=”label label-default”>New</span></h3>
<h4>Example <span class=”label label-default”>New</span></h4>
<h5>Example <span class=”label label-default”>New</span></h5>
<h6>Example <span class=”label label-default”>New</span></h6>
Try it Yourself »

The following example shows all contextual label classes:

Default Label Primary Label Success Label Info Label Warning Label Danger Label

Example

<span class=”label label-default”>Default Label</span>
<span class=”label label-primary”>Primary Label</span>
<span class=”label label-success”>Success Label</span>
<span class=”label label-info”>Info Label</span>
<span class=”label label-warning”>Warning Label</span>
<span class=”label label-danger”>Danger Label</span>
Try it Yourself »

 

Bootstrap Progress Bars

« Previous

Next Chapter »

Basic Progress Bar

A progress bar can be used to show a user how far along he/she is in a process.

Bootstrap provides several types of progress bars.

A default progress bar in Bootstrap looks like this:

70% Complete

To create a default progress bar, add a .progress class to a 

 element:

Example

70% Complete

</div>
Try it Yourself »

Note: Progress bars are not supported in Internet Explorer 9 and earlier (because they use CSS3 transitions and animations to achieve some of their effects).

Progress Bar With Label

A progress bar with a label looks like this:

70%

Remove the .sr-only class from the progress bar to show a visible percentage:

Example

70%

</div>
Try it Yourself »

Colored Progress Bars

Contextual classes are used to provide “meaning through colors”.

The contextual classes that can be used with progress bars are:

  • .progress-bar-success
  • .progress-bar-info
  • .progress-bar-warning
  • .progress-bar-danger

40% Complete (success)

50% Complete (info)

60% Complete (warning)

70% Complete (danger)

The following example shows how to create progress bars with the different contextual classes:

Example

40% Complete (success)

</div>

50% Complete (info)

</div>

60% Complete (warning)

</div>

70% Complete (danger)

</div>
Try it Yourself »

Striped Progress Bars

Progress bars can also be striped:

40% Complete (success)

50% Complete (info)

60% Complete (warning)

70% Complete (danger)

Add class .progress-bar-striped to add stripes to the progress bars:

Example

40% Complete (success)

</div>

50% Complete (info)

</div>

60% Complete (warning)

</div>

70% Complete (danger)

</div>
Try it Yourself »

Animated Progress Bar

Here is an “animated” progress bar:

40%

Add class .active to animate the progress bar:

Example

40%

</div>
Try it Yourself »

Stacked Progress Bars

Progress bars can also be stacked:

Free Space

Warning

Danger

Create a stacked progress bar by placing multiple bars into the same 

:

Example

Free Space
Warning
Danger

</div>
Try it Yourself »

Test Yourself with Exercises!

Exercise 1 »

 

Bootstrap Pagination

« Previous

Next Chapter »

Basic Pagination

If you have a web site with lots of pages, you may wish to add some sort of pagination to each page.

A basic pagination in Bootstrap looks like this:

To create a basic pagination, add the .pagination class to an <ul> element:

Example

<ul class=”pagination”>
<li><a href=”#”>1</a></li>
<li><a href=”#”>2</a></li>
<li><a href=”#”>3</a></li>
<li><a href=”#”>4</a></li>
<li><a href=”#”>5</a></li>
</ul>
Try it Yourself »

Active State

The active state shows what is the current page:

Add class .active to let the user know which page he/she is on:

Example

<ul class=”pagination”>
<li><a href=”#”>1</a></li>
<li class=”active”><a href=”#”>2</a></li>
<li><a href=”#”>3</a></li>
<li><a href=”#”>4</a></li>
<li><a href=”#”>5</a></li>
</ul>
Try it Yourself »

Disabled State

A disabled link cannot be clicked:

Add class .disabled if a link for some reason is disabled:

Example

<ul class=”pagination”>
<li><a href=”#”>1</a></li>
<li><a href=”#”>2</a></li>
<li><a href=”#”>3</a></li>
<li class=”disabled”><a href=”#”>4</a></li>
<li><a href=”#”>5</a></li>
</ul>
Try it Yourself »

Pagination Sizing

Pagination blocks can also be sized to a larger size or a smaller size:

 

Add class .pagination-lg for larger blocks or .pagination-sm for smaller blocks:

Example

<ul class=”pagination pagination-lg”>
<li><a href=”#”>1</a></li>
<li><a href=”#”>2</a></li>
<li><a href=”#”>3</a></li>
<li><a href=”#”>4</a></li>
<li><a href=”#”>5</a></li>
</ul>

<ul class=”pagination pagination-sm”>
<li><a href=”#”>1</a></li>
<li><a href=”#”>2</a></li>
<li><a href=”#”>3</a></li>
<li><a href=”#”>4</a></li>
<li><a href=”#”>5</a></li>
</ul>
 

 

Bootstrap Pager

« Previous

Next Chapter »

What is Pager?

Pager is also a form of pagination (as described in the previous chapter).

Pager provides previous and next buttons (links).

To create previous/next buttons, add the .pager class to an <ul> element:

Example

<ul class=”pager”>
<li><a href=”#”>Previous</a></li>
<li><a href=”#”>Next</a></li>
</ul>

 

Result:

Try it Yourself »

Align Buttons

Use the .previous and .next classes to align each button to the sides of the page:

Example

<ul class=”pager”>
<li class=”previous”><a href=”#”>Previous</a></li>
<li class=”next”><a href=”#”>Next</a></li>
</ul>

 

Result:

 

Bootstrap List Groups

« Previous

Next Chapter »

Basic List Groups

The most basic list group is an unordered list with list items:

  • First item
  • Second item
  • Third item

To create a basic list group, use an <ul> element with class .list-group, and <li> elements with class .list-group-item:

Example

<ul class=”list-group”>
<li class=”list-group-item”>First item</li>
<li class=”list-group-item”>Second item</li>
<li class=”list-group-item”>Third item</li>
</ul>
Try it Yourself »

List Group With Badges

You can also add badges to a list group. The badges will automatically be positioned on the right:

  • 12New
  • 5Deleted
  • 3Warnings

To create a badge, create a <span> element with class .badge inside the list item:

Example

<ul class=”list-group”>
<li class=”list-group-item”><span class=”badge”>12</span> New</li>
<li class=”list-group-item”><span class=”badge”>5</span> Deleted</li>
<li class=”list-group-item”><span class=”badge”>3</span> Warnings</li>
</ul>
Try it Yourself »

List Group With Linked Items

The items in a list group can also be hyperlinks:

First itemSecond itemThird item

To create a list group with linked items, use 

 instead of 

     and  instead of 

  • :

    Example

    Try it Yourself »

    Disabled Item

    The following list group has a disabled item:

    First itemSecond itemThird item

    To disable an item, add the .disabled class:

    Example

    Try it Yourself »

    Contextual Classes

    Contextual classes can be used to color list items:

    • First item
    • Second item
    • Third item
    • Fourth item

    The classes for coloring list-items are: .list-group-item-success, list-group-item-info, list-group-item-warning, and .list-group-item-danger:

    Example

    <ul class=”list-group”>
    <li class=”list-group-item list-group-item-success”>First item</li>
    <li class=”list-group-item list-group-item-info”>Second item</li>
    <li class=”list-group-item list-group-item-warning”>Third item</li>
    <li class=”list-group-item list-group-item-danger”>Fourth item</li>
    </ul>
    Try it Yourself »

    Custom Content

    You can add nearly any HTML inside a list group item.

    Bootstrap provides the classes .list-group-item-heading and .list-group-item-text which can be used as follows:

    Example

     

    Bootstrap Panels

    « Previous

    Next Chapter »

    Panels

    A panel in bootstrap is a bordered box with some padding around its content:

    A Basic Panel

    Panels are created with the .panel class, and content inside the panel has a .panel-body class:

    Example

    A Basic Panel

    </div>
    Try it Yourself »

    The .panel-default class is used to style the color of the panel. See the last example on this page for more contextual classes.

    Panel Heading

    Panel Heading

    Panel Content

    The .panel-heading class adds a heading to the panel:

    Example

    Panel Heading
    Panel Content

    </div>
    Try it Yourself »

    Panel Footer

    Panel Content

    Panel Footer

    The .panel-footer class adds a footer to the panel:

    Example

    A Basic Panel
    Panel Footer

    </div>
    Try it Yourself »

    Panel Group

    To group many panels together, wrap a 

     with class .panel-group around them.

    The .panel-group class clears the bottom-margin of each panel:

    Example

    Panel Content

    </div>

    Panel Content

    </div>
    </div>
    Try it Yourself »

    Panels with Contextual Classes

    To color the panel, use contextual classes (.panel-default, .panel-primary, .panel-success, .panel-info,.panel-warning, or .panel-danger):

    Example

    Panel with panel-default class

    Panel Content

    Panel with panel-primary class

    Panel Content

    Panel with panel-success class

    Panel Content

    Panel with panel-info class

    Panel Content

    Panel with panel-warning class

    Panel Content

    Panel with panel-danger class

    Panel Content

     

    Bootstrap Dropdowns

    « Previous

    Next Chapter »

    Basic Dropdown

    A dropdown menu is a toggleable menu that allows the user to choose one value from a predefined list:

    Dropdown Example

    Example

    Dropdown Example

    Try it Yourself »

    Example Explained

    The .dropdown class indicates a dropdown menu.

    To open the dropdown menu, use a button or a link with a class of .dropdown-toggle and the data-toggle=”dropdown” attribute.

    The .caret class creates a caret arrow icon (), which indicates that the button is a dropdown.

    Add the .dropdown-menu class to a <ul> element to actually build the dropdown menu.

    Dropdown Divider

    The .divider class is used to separate links inside the dropdown menu:

    Example

    <li class=”divider”></li>
    Try it Yourself »

    Dropdown Header

    Dropdown Header Example

    The .dropdown-header class is used to add headers inside the dropdown menu:

    Example

    <li class=”dropdown-header”>Dropdown header 1</li>
    Try it Yourself »

    Disable an Item

    Dropdown Disabled Example

    To disable an item in the dropdown menu, use the .disabled class:

    Example

    <li class=”disabled”><a href=”#”>CSS</a></li>
    Try it Yourself »

    Dropdown Position

    Dropdown Right Example

    To right-align the dropdown, add the .dropdown-menu-right class to the element with .dropdown-menu:

    Example

    <ul class=”dropdown-menu dropdown-menu-right”>
    Try it Yourself »

    Dropup Example

    If you want the dropdown menu to expand upwards instead of downwards, change the

    element with class=”dropdown” to “dropup”:

    Example

    Try it Yourself »

    Dropdown Accessibility

    To help improve accessibility for people using screen readers, you should include the following role and aria-*attributes, when creating a dropdown menu:

    Example

     

     

    Bootstrap Tabs and Pills

    « Previous

    Next Chapter »

    Menus

    Most web pages have some kind of a menu.

    In HTML, a menu is often defined in an unordered list <ul> (and styled afterwards), like this:

    <ul>
    <li><a href=”#”>Home</a></li>
    <li><a href=”#”>Menu 1</a></li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>

    If you want to create a horizontal menu of the list above, add the .list-inline class to <ul>:

    <ul class=”list-inline”>
    Try it Yourself »

    Or you can display the menu above with Bootstraps’ Tabs and Pills (see below).

    Tabs

    Tabs are created with <ul class=”nav nav-tabs”>:

    Tip: Also mark the current page with <li class=”active”>.

    The following example creates navigation tabs:

    Example

    <ul class=”nav nav-tabs”>
    <li class=”active”><a href=”#”>Home</a></li>
    <li><a href=”#”>Menu 1</a></li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>
    Try it Yourself »

    Tabs With Dropdown Menu

    Tabs can also hold dropdown menus.

    The following example adds a dropdown menu to “Menu 1”:

    Example

    <ul class=”nav nav-tabs”>
    <li class=”active”><a href=”#”>Home</a></li>
    <li class=”dropdown”>
    <a class=”dropdown-toggle” data-toggle=”dropdown” href=”#”>Menu 1
    <span class=”caret”></span></a>
    <ul class=”dropdown-menu”>
    <li><a href=”#”>Submenu 1-1</a></li>
    <li><a href=”#”>Submenu 1-2</a></li>
    <li><a href=”#”>Submenu 1-3</a></li>
    </ul>
    </li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>
    Try it Yourself »

    Pills

    Pills are created with <ul class=”nav nav-pills”>. Also mark the current page with <li class=”active”>:

    Example

    <ul class=”nav nav-pills”>
    <li class=”active”><a href=”#”>Home</a></li>
    <li><a href=”#”>Menu 1</a></li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>
    Try it Yourself »

    Vertical Pills

    Pills can also be displayed vertically. Just add the .nav-stacked class.

    The following example places the vertical pill menu inside the last column. So, on a large screen the menu will be displayed to the right. But on a small screen, the content will automatically adjust itself into a single-column layout:

    Example

    Try it Yourself »

    Pills With Dropdown Menu

    Pills can also hold dropdown menus.

    The following example adds a dropdown menu to “Menu 1”:

    Example

    <ul class=”nav nav-pills nav-stacked”>
    <li class=”active”><a href=”#”>Home</a></li>
    <li class=”dropdown”>
    <a class=”dropdown-toggle” data-toggle=”dropdown” href=”#”>Menu 1
    <span class=”caret”></span></a>
    <ul class=”dropdown-menu”>
    <li><a href=”#”>Submenu 1-1</a></li>
    <li><a href=”#”>Submenu 1-2</a></li>
    <li><a href=”#”>Submenu 1-3</a></li>
    </ul>
    </li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>
    Try it Yourself »

    Centered Tabs and Pills

    To center/justify the tabs and pills, use the .nav-justified class.

    Note that on screens that are smaller than 768px, the list items are stacked (content will remain centered):

    Example

    <!– Centered Tabs –>
    <ul class=”nav nav-tabs nav-justified”>
    <li class=”active”><a href=”#”>Home</a></li>
    <li><a href=”#”>Menu 1</a></li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>

    <!– Centered Pills –>
    <ul class=”nav nav-pills nav-justified”>
    <li class=”active”><a href=”#”>Home</a></li>
    <li><a href=”#”>Menu 1</a></li>
    <li><a href=”#”>Menu 2</a></li>
    <li><a href=”#”>Menu 3</a></li>
    </ul>
    Try it Yourself »

    Dynamic Tabs

    To make the tabs toggable, add the data-toggle=”tab” attribute to each link. Then add a .tab-pane class with a unique ID for every tab and wrap them inside a 

     element with class .tab-content.

    If you want the tabs to fade in and out when clicking on them, add the .fade class to .tab-pane:

    Example

    HOME

    Some content.

    Menu 1

    Some content in menu 1.

    Menu 2

    Some content in menu 2.

    </div>
    Try it Yourself »

    Dynamic Pills

    The same code applies to pills; only change the data-toggle attribute to data-toggle=”pill”:

    Example

    <ul class=”nav nav-pills”>
    <li class=”active”><a data-toggle=”pill” href=”#home”>Home</a></li>
    <li><a data-toggle=”pill” href=”#menu1″>Menu 1</a></li>
    <li><a data-toggle=”pill” href=”#menu2″>Menu 2</a></li>
    </ul>

    HOME

    Some content.

    Menu 1

    Some content in menu 1.

    Menu 2

    Some content in menu 2.

    </div>
    Try it Yourself »

    Bootstrap Navigation Bar

    « Previous

    Next Chapter »

    Navigation Bars

    A navigation bar is a navigation header that is placed at the top of the page:

    WebSiteName

    With Bootstrap, a navigation bar can extend or collapse, depending on the screen size.

    A standard navigation bar is created with <nav class=”navbar navbar-default”>.

    The following example shows how to add a navigation bar to the top of the page:

    Example

    <body>
    <nav class=”navbar navbar-default”>

    </div>
    </nav>

    Try it Yourself »

    All of the examples on this page will show a navigation bar that takes up too much space on small screens (however, the navigation bar will be on one single line on large screens – because Bootstrap is responsive). This problem (with the small screens) will be solved in the last example on this page!

    Inverted Navigation Bar

    If you don’t like the style of the default navigation bar, Bootstrap provides an alternative, black navbar:

    WebSiteName

    Just change the .navbar-default class into .navbar-inverse:

    Example

    <nav class=”navbar navbar-inverse”>

    </div>
    </nav>
    Try it Yourself »

    Fixed Navigation Bar

    The navigation bar can also be fixed at the top or at the bottom of the page.

    A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

    The .navbar-fixed-top class makes the navigation bar fixed at the top:

    Example

    <nav class=”navbar navbar-inverse navbar-fixed-top”>

    </div>
    </nav>
    Try it Yourself »

    The .navbar-fixed-bottom class makes the navigation bar stay at the bottom:

    Example

    <nav class=”navbar navbar-inverse navbar-fixed-bottom”>

    </div>
    </nav>
    Try it Yourself »

    Navigation Bar With Dropdown

    WebSiteName

    Navigation bars can also hold dropdown menus.

    The following example adds a dropdown menu for the “Page 1” button:

    Example

    <nav class=”navbar navbar-inverse”>

    </div>
    </nav>
    Try it Yourself »

    Right-Aligned Navigation Bar

    WebSiteName

    The .navbar-right class is used to right-align navigation bar buttons.

    In the following example we insert a “Sign Up” button and a “Login” button to the right in the navigation bar. We also add a glyphicon on each of the two new buttons:

    Example

    <nav class=”navbar navbar-inverse”>

    </div>
    </nav>
    Try it Yourself »

    Collapsing The Navigation Bar

    The navigation bar takes up too much space on a small screen.

    We should hide the navigation bar; and only show it when it is needed.

    In the following example the navigation bar is replaced by a button in the top right corner. Only when the button is clicked, the navigation bar will be displayed:

    Example

    <nav class=”navbar navbar-inverse”>

    </div>
    </nav>

     

    Bootstrap Forms

    « Previous

    Next Chapter »

    Bootstrap’s Default Settings

    Form controls automatically receive some global styling with Bootstrap:

    All textual <input>, <textarea>, and <select> elements with class .form-control have a width of 100%.

    Bootstrap Form Layouts

    Bootstrap provides three types of form layouts:

    • Vertical form (this is default)
    • Horizontal form
    • Inline form

    Standard rules for all three form layouts:

    • Always use <form role=”form”> (helps improve accessibility for people using screen readers)
    • Wrap labels and form controls in 
       (needed for optimum spacing)
    • Add class .form-control to all textual , , and  elements

    Bootstrap Vertical Form (default)

    Email:

    Password:

    Remember me

    Submit

    The following example creates a vertical form with two input fields, one checkbox, and a submit button:

    Example

    Email address:

    Password:

     Remember me

    <button type=”submit” class=”btn btn-default”>Submit</button>
    </form>
    Try it Yourself »

    Bootstrap Inline Form

    Email:

     

    Password:

     

    Remember me

    Submit

    In an inline form, all of the elements are inline, left-aligned, and the labels are alongside.

    Note: This only applies to forms within viewports that are at least 768px wide!

    Additional rule for an inline form:

    • Add class .form-inline to the <form> element

    The following example creates an inline form with two input fields, one checkbox, and one submit button:

    Example

    <form class=”form-inline” role=”form”>

    Email address:

    Password:

     Remember me

    <button type=”submit” class=”btn btn-default”>Submit</button>
    </form>
    Try it Yourself »

    Tip: If you don’t include a label for every input, screen readers will have trouble with your forms. You can hide the labels for all devices, except screen readers, by using the .sr-only class:

    Example

    <form class=”form-inline” role=”form”>

    Email address:

    Password:

     Remember me

    <button type=”submit” class=”btn btn-default”>Submit</button>
    </form>
    Try it Yourself »

    Bootstrap Horizontal Form

    Email:

    Password:

    Remember me

    Submit

    A horizontal form stands apart from the other forms both in the amount of markup, and in the presentation of the form.

    Additional rules for a horizontal form:

    • Add class .form-horizontal to the <form> element
    • Add class .control-label to all <label> elements

    Tip: Use Bootstrap’s predefined grid classes to align labels and groups of form controls in a horizontal layout.

    The following example creates a horizontal form with two input fields, one checkbox, and one submit button:

    Example

    <form class=”form-horizontal” role=”form”>

    Email:

    </div>

    Password:

    </div>

     Remember me

    </div>
    </div>

    Submit

    </div>
    </form>

     

    Bootstrap Form Inputs

    « Previous

    Next Chapter »

    Supported Form Controls

    Bootstrap supports the following form controls:

    • input
    • textarea
    • checkbox
    • radio
    • select

    Bootstrap Input

    Bootstrap supports all the HTML5 input types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color.

    Note: Inputs will NOT be fully styled if their type is not properly declared!

    Name:

    Password:

    The following example contains two input elements; one of type text and one of type password:

    Example

    Name:

    Password:

    Try it Yourself »

    Bootstrap Textarea

    Comment:

    The following example contains a textarea:

    Example

    Comment:

    Try it Yourself »

    Bootstrap Checkboxes

    Option 1

    Option 2

    Option 3

    Checkboxes are used if you want the user to select any number of options from a list of preset options.

    The following example contains three checkboxes. The last option is disabled:

    Example

    Option 1
    Option 2
    Option 3

    Try it Yourself »

    Use the .checkbox-inline class if you want the checkboxes to appear on the same line:

    Option 1 Option 2 Option 3

    Example

    <label class=”checkbox-inline”><input type=”checkbox” value=””>Option 1</label>
    <label class=”checkbox-inline”><input type=”checkbox” value=””>Option 2</label>
    <label class=”checkbox-inline”><input type=”checkbox” value=””>Option 3</label>
    Try it Yourself »

    Bootstrap Radio Buttons

    Option 1

    Option 2

    Option 3

    Radio buttons are used if you want to limit the user to just one selection from a list of preset options.

    The following example contains three radio buttons. The last option is disabled:

    Example

    Option 1
    Option 2
    Option 3

    Try it Yourself »

    Use the .radio-inline class if you want the radio buttons to appear on the same line:

    Option 1 Option 2 Option 3

    Example

    <label class=”radio-inline”><input type=”radio” name=”optradio”>Option 1</label>
    <label class=”radio-inline”><input type=”radio” name=”optradio”>Option 2</label>
    <label class=”radio-inline”><input type=”radio” name=”optradio”>Option 3</label>
    Try it Yourself »

    Bootstrap Select List

    Select list (select one):                                   1 2 3 4
    Mutiple select list (hold shift to select more than one):                                            1 2 3 4 5

    Select lists are used if you want to allow the user to pick from multiple options.

    The following example contains a dropdown list (select list):

    Example

    Select list:

    1
    2
    3
    4

     

    Bootstrap Form Inputs (more)

    « Previous

    Next Chapter »

    Static Control

    If you need to insert plain text next to a form label within a horizontal form, use the .form-control-static class on a <p> element:

    Example

    <form class=”form-horizontal” role=”form”>

    Email:

    someone@example.com

    </div>
    </form>
    Try it Yourself »

    Bootstrap Form Control States

    • INPUT FOCUS – The outline of the input is removed and a box-shadow is applied on focus
    • DISABLED INPUTS – Add a disabled attribute to disable an input field
    • DISABLED FIELDSETS – Add a disabled attribute to a fieldset to disable all controls within
    • READONLY INPUTS – Add a readonly attribute to an input to prevent user input
    • VALIDATION STATES – Bootstrap includes validation styles for error, warning, and success messages. To use, add .has-warning, .has-error, or .has-success to the parent element
    • ICONS – You can add feedback icons with the .has-feedback class and an icon
    • HIDDEN LABELS – Add a .sr-only class on non-visible labels

    The following example demonstrates some of the form control states above in a Horizontal form:

    Example

    <form class=”form-horizontal” role=”form”>

    Focused

    </div>

    Disabled

    </div>
    <fieldset disabled>

    Fieldset disabled

    </div>

    Disabled select

    </div>
    </fieldset>

    Input with success and icon

    </div>

    Input with warning and icon

    </div>

    Input with error and icon

    </div>
    </form>
    Try it Yourself »

    And here is an example of some of the form control states in an Inline form:

    Example

    <form class=”form-inline” role=”form”>

    Focused

    Disabled

    Input with success

    Input with warning

    Input with error

    </form>

     

    Bootstrap Input Sizing

    « Previous

    Next Chapter »

    Input Sizing in Forms

    Set the heights of input elements using classes like .input-lg and .input-sm.

    Set the widths of elements using grid column classes like .col-lg-*and .col-sm-*.

    Height Sizing

    Small input

    Default input

    Large input

    The following examples shows input elements with different heights:

    Example

    <form role=”form”>

    Default input

    input-lg

    input-sm

    </form>
    Try it Yourself »

    You can quickly size labels and form controls within a Horizontal form by adding .form-group-* to the 

     element:

    Example

    form-group-lg

    </div>

    form-group-sm

    </div>
    </form>
    Try it Yourself »

    Column Sizing

    col-xs-2

    col-xs-3

    col-xs-4

    The following examples shows input elements with different widths using different .col-xs-* classes:

    Example

    col-xs-2

    col-xs-3

    col-xs-4

    Try it Yourself »

    Help Text

    Use the .help-block class to add a block level help text in forms:

    Example

    Password:

    This is some help text…

     

     

    Bootstrap Carousel Plugin

    « Previous

    Next Chapter »

    The Carousel Plugin

    The Carousel plugin is a component for cycling through elements, like a carousel (slideshow).

    Tip: Plugins can be included individually (using Bootstrap’s individual “carousel.js” file), or all at once (using “bootstrap.js” or “bootstrap.min.js”).

    Carousel Example

     

     

     

     

    Chania

    The atmosphere in Chania has a touch of Florence and Venice.

    PreviousNext

     

    Note: Carousels are not supported properly in Internet Explorer 9 and earlier (because they use CSS3 transitions and animations to achieve the slide effect).

    How To Create a Carousel

    The following example shows how to create a basic carousel:

    Example

    </div>

    <!– Left and right controls –>
    <a class=”left carousel-control” href=”#myCarousel” role=”button” data-slide=”prev”>
    <span class=”glyphicon glyphicon-chevron-left” aria-hidden=”true”></span>
    <span class=”sr-only”>Previous</span>
    </a>
    <a class=”right carousel-control” href=”#myCarousel” role=”button” data-slide=”next”>
    <span class=”glyphicon glyphicon-chevron-right” aria-hidden=”true”></span>
    <span class=”sr-only”>Next</span>
    </a>
    </div>
    Try it Yourself »

    Example Explained

    The outermost

    :

    Carousels require the use of an id (in this case id=”myCarousel”) for carousel controls to function properly.

    The class=”carousel” specifies that this 

     contains a carousel.

    The .slide class adds a CSS transition and animation effect, which makes the items slide when showing a new item. Omit this class if you do not want this effect.

    The data-ride=”carousel” attribute tells Bootstrap to begin animating the carousel immediately when the page loads.

    The “Indicators” part:

    The indicators are the little dots at the bottom of each slide (which indicates how many slides there are in the carousel, and which slide the user are currently viewing).

    The indicators are specified in an ordered list with class .carousel-indicators.

    The .data-target class points to the id of the carousel.

    The .data-slide-to class specifies which slide to go to, when clicking on the specific dot.

    The “Wrapper for slides” part:

    The slides are specified in a 

     with class .carousel-inner.

    The content of each slide is defined in a 

     with class .item. This can be text or images.

    The .active class needs to be added to one of the slides. Otherwise, the carousel will not be visible.

    The “Left and right controls” part:

    This code adds “left” and “right” buttons that allows the user to go back and forth between the slides manually.

    The data-slide attribute accepts the keywords “prev” or “next”, which alters the slide position relative to its current position.

    Add Captions to Slides

    Add