Professional Documents
Culture Documents
— Introducción a Bootstrap —
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Introducción . Competitors and users 7/35
Introduction Minimal bootstrap page I
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport"
7 content="width=device-width, initial-scale=1">
8 <title>My 1st Bootstrap page</title>
9 <link rel="stylesheet" type="text/css"
10 href="css/bootstrap.css">
11 <!--[if lt IE 9]>
12 <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/
html5shiv.js"></script>
13 <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/
respond.min.js"></script>
14 <![endif]-->
15 </head>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Introducción . Minimal bootstrap page 8/35
Introduction Minimal bootstrap page II
16 <body>
17 <h1>A header</h1>
18 <!-- *********************
19 ** PAGE CONTENTS **
20 ********************* -->
21
22 <!-- these at the end of the page -->
23 <script src="js/jquery.js"></script>
24 <script src="js/bootstrap.js"></script>
25 </body>
26 </html>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Introducción . Minimal bootstrap page 9/35
Introduction Minimal bootstrap page III
4 <meta charset="utf-8">
6 <meta name="viewport"
7 content="width=device-width, initial-scale=1">
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Introducción . Minimal bootstrap page 10/35
Introduction Minimal bootstrap page IV
11 <!--[if lt IE 9]>
12 <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/
html5shiv.js"></script>
13 <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/
respond.min.js"></script>
14 <![endif]-->
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Introducción . Minimal bootstrap page 11/35
Grid system
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Grid system . What is a grid system? 13/35
Containers
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Grid system . Rows and columns 16/35
Offsetting Columns
1 <div class="row">
2 <div class="col-xs-6 col-xs-offset-3 col1">
3 <h1>Hello Learnable!</h1>
4 </div>
5 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Grid system . Rows and columns 17/35
Reordering Columns
q We can also reorder the columns irrespective of the order in
which they are written using Bootstrap’s pull (to the left) and
push (to the right) classes:
5 col-xs-pull-* and col-xs-push-* for extra smaller screens.
5 col-sm-pull-* and col-sm-push-* for smaller screens
5 col-md-pull-* and col-md-push-* for medium screens
5 col-lg-pull-* and col-lg-push-* for larger screens
q For example, to swap two columns:
1 <div class="row">
2 <div class="col-xs-9 col-xs-push-3">
3 <h1>Pushed Column</h1>
4 </div>
5 <div class="col-xs-3 col-xs-pull-9">
6 <h1>Pulled Column</h1>
7 </div>
8 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Grid system . Rows and columns 18/35
Bootstrap components
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 20/35
Panels
Panels are used to display text or images within a box with rounded corners.
Panels come with various color options: panel-primary (for dark blue), panel-success (for
green), panel-info (for sky blue), panel-warning (for yellow), panel-danger (for red).
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 21/35
Panels
Panels are used to display text or images within a box with rounded corners.
Panels come with various color options: panel-primary (for dark blue), panel-success (for
green), panel-info (for sky blue), panel-warning (for yellow), panel-danger (for red).
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 21/35
Panels
Panels are used to display text or images within a box with rounded corners.
Panels come with various color options: panel-primary (for dark blue), panel-success (for
green), panel-info (for sky blue), panel-warning (for yellow), panel-danger (for red).
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 21/35
Panels
Panels are used to display text or images within a box with rounded corners.
Panels come with various color options: panel-primary (for dark blue), panel-success (for
green), panel-info (for sky blue), panel-warning (for yellow), panel-danger (for red).
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 21/35
Panels
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 22/35
Media object
Media object is used for creating components that should contain left- or right-
aligned media (image, video, or audio) alongside some textual content.
It is best suited for creating features such as a comments section, displaying tweets, or showing
product details where a product image is present.
1 <div class="media">
2 <a class="pull-left" href="#">
3 <img class="media-object" src="path/to/image" alt="Syed
Fazle Rahman">
4 </a>
5 <div class="media-body">
6 <h4 class="media-heading">Awesome piece of work!</h4>
7 <p>Lorem ipsum dolor sit amet, consectetur ...</p>
8 </div>
9 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 23/35
Media object
Media object is used for creating components that should contain left- or right-
aligned media (image, video, or audio) alongside some textual content.
It is best suited for creating features such as a comments section, displaying tweets, or showing
product details where a product image is present.
1 <div class="media">
2 <a class="pull-left" href="#">
3 <img class="media-object" src="path/to/image" alt="Syed
Fazle Rahman">
4 </a>
5 <div class="media-body">
6 <h4 class="media-heading">Awesome piece of work!</h4>
7 <p>Lorem ipsum dolor sit amet, consectetur ...</p>
8 </div>
9 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 23/35
Media object
Media object is used for creating components that should contain left- or right-
aligned media (image, video, or audio) alongside some textual content.
It is best suited for creating features such as a comments section, displaying tweets, or showing
product details where a product image is present.
1 <div class="media">
2 <a class="pull-left" href="#">
3 <img class="media-object" src="path/to/image" alt="Syed
Fazle Rahman">
4 </a>
5 <div class="media-body">
6 <h4 class="media-heading">Awesome piece of work!</h4>
7 <p>Lorem ipsum dolor sit amet, consectetur ...</p>
8 </div>
9 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 23/35
Media object
Media object is used for creating components that should contain left- or right-
aligned media (image, video, or audio) alongside some textual content.
It is best suited for creating features such as a comments section, displaying tweets, or showing
product details where a product image is present.
1 <div class="media">
2 <a class="pull-left" href="#">
3 <img class="media-object" src="path/to/image" alt="Syed
Fazle Rahman">
4 </a>
5 <div class="media-body">
6 <h4 class="media-heading">Awesome piece of work!</h4>
7 <p>Lorem ipsum dolor sit amet, consectetur ...</p>
8 </div>
9 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 23/35
Media object
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 24/35
List group
List group is a useful component for creating lists, such as a list of useful
resources, a list of recent activities, or even for a complex list of large amounts
of textual content.
1 <ul class="list-group">
2 <li class="list-group-item">Inbox</li>
3 <li class="list-group-item">Sent</li>
4 <li class="list-group-item">Drafts</li>
5 <li class="list-group-item">Deleted</li>
6 <li class="list-group-item">Spam</li>
7 </ul>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Page components 25/35
Breadcrumbs
Breadcrumbs are used to show the current page’s location in the site hierarchy.
1 <ol class="breadcrumb">
2 <li><a href="#">Home</a></li>
3 <li><a href="#">About</a></li>
4 <li class="active">Author</li>
5 </ol>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Navigation systems 26/35
Nav pills
1 <ul class="nav nav-tabs">
2 <li class="active"><a href="#">About</a></li>
3 <li><a href="#">Activity</a></li>
4 <li><a href="#">Liked Pages</a></li>
5 </ul>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Navigation systems 27/35
Nav stacked
1 <ul class="nav nav-pills nav-stacked">
2 <li class="active"><a href="#">About</a></li>
3 <li><a href="#">Activity</a></li>
4 <li><a href="#">Liked Pages</a></li>
5 </ul>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Navigation systems 28/35
Labels
Labels are the best way to display short text beside other components (e. g.
“New”, “Download now”, . . . )
The available label variants are:label-default (for gray), label-primary (for dark blue),
label-success (for green), label-info (for light blue), label-warning (for orange), label-danger (for
red).
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Small components 29/35
Buttons
To create a fancy button in Bootstrap it is only neccessary to add the btn class to
convert an a, button, or input element.
Buttons come in various color options: btn-default (for white), btn-primary (for dark blue),
btn-success (for green), btn-info (for light blue), btn-warning (for orange), btn-danger (for red).
And in various sizes: btn-lg (for large buttons), btn-sm (for small buttons), btn-xs (for extra small
buttons).
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Small components 30/35
Labels
Glyphicons are used to display small icons
(http://getbootstrap.com/components/#glyphicons). They are lightweight font
icons and not images. There are many advantages of using a glyphicon instead
of small images, including:
q saving multiple requests for small images or sprites
q as they are font icons, their colors and sizes can be varied on the go using CSS properties
q that they look crisp and sharp in all kind of displays.
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Small components 31/35
Wells
Wells are a useful component that wrap the content within a rounded cornered
box with a gray background, giving an inset effect to the content. They can be
used to highlight important facts amongst long textual content, for example, or
an author’s bio box in a blogging application:
1 <div class="well">
2 <p>Lorem ipsum dolor sit amet, ... </p>
3 </div>
cgosorio@ubu.es Diseño Web . Introducción a Bootstrap . Bootstrap components . Small components 32/35
Forms