Boot 1
Boot 1
FRONT-END FRAMEWORK
BOOTSTRAP
RESPONSIVE WEB DESIGN
Responsive web design is about creating websites which automatically adjust themselves to look good on all devices, from small
phones to large desktops.
• Mobiles
• Tablets
• Desktops
• Big displays
Bootstrap
Bootstrap is a front-end CSS Framework used to build beautiful responsive User interfaces.
1. Mobile-first design (Responsive grid system)
2. Reusable classes to help style our content.
3. Inbuilt UI elements such as buttons, cards, modals etc
History
Features
Bootstrap Packages
Boostrap Containers:
HTML( WITHOUT USING BOOTSTRAP CONTAINER)
USING BOOTSTRAP CONTAINER
Container
Use .container for a responsive fixed width container.
<div class="container">
...
</div>
Container fluid
Use .container-fluid for a full-width container, spanning the entire width of your viewport
<div class="container-fluid">
...
</div>
If you do not want to use all 12 columns individually, you can group the columns together to create wider columns:
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:
First; create a row (<div class="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.
Example:
<body>
<div class="container-fluid">
<h1>Hello World!</h1>
<p>Resize the browser window to see the effect.</p>
<p>The columns will automatically stack on top of each other when the screen is less than 768px wide.</p>
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">.col-sm-4</div>
<div class="col-sm-4" style="background-color:lavenderblush;">.col-sm-4</div>
<div class="col-sm-4" style="background-color:lavender;">.col-sm-4</div>
</div>
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">.col-sm-4</div>
<div class="col-sm-4" style="background-color:lavenderblush;">.col-sm-4</div>
<div class="col-sm-4" style="background-color:lavender;">.col-sm-4</div>
</div>
</div>
</body>
</html>
OUTPUT
Container:
<body>
<div class="container">
<h1>Hello World!</h1>
<p>Resize the browser window to see the effect.</p>
<p>The columns will automatically stack on top of each other when the screen is less than 768px wide.</p>
<div class="row">
<div class="col-sm-4" style="background-color:lavender;">WELCOME TO</div>
<div class="col-sm-4" style="background-color:lavenderblush;">WEB TECHNOLOGY</div>
<div class="col-sm-4" style="background-color:lavender;">BOOSTRAP</div>
</div>
</div>
</body>
</html>
Output
The following example shows how to get a three equal-width columns starting at tablets and scaling to large
desktops. On mobile phones or screens that are less than 768px wide, the columns will automatically stack:
Example
OUTPUT
<small>
In Bootstrap the HTML <small> element is used to create a lighter, secondary text in any heading:
OUTPUT
<mark>
Bootstrap will style the HTML <mark> element in the following way:
<div class="container">
<h1>Highlight Text</h1>
<p>Use the mark element to <mark>highlight</mark> text.</p>
</div>
</body>
</html>
OUTPUT
<abbr>
Bootstrap will style the HTML <abbr> element in the following way:
<dl>
Bootstrap will style the HTML <dl> element in the following way:
<code>
Bootstrap will style the HTML <code> element in the following way:
<kbd>
Bootstrap will style the HTML <kbd> element in the following way:
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:
The classes for background colors are:.bg-primary, .bg-success, .bg-info, .bg-warning, and .bg-danger:
Text Alignment
<div class="container">
<h2>Typography</h2>
<p>The class .list-inline places all list items on a single line:</p>
<ul class="list-inline">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
</div>
OUTPUT
.listunstyled
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)
Bootstrap Basic Table
A basic Bootstrap table has a light padding and only horizontal dividers.
<body>
<div class="container">
<h2>Basic Table</h2>
<p>The .table class adds basic styling (light padding and only horizontal dividers) to a table:</p>
<table class="table">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Doe</td>
<td>[email protected]</td>
</tr>
<tr>
<td>Mary</td>
<td>Moe</td>
<td>[email protected]</td>
</tr>
<tr>
<td>July</td>
<td>Dooley</td>
<td>[email protected]</td>
</tr>
</tbody>
</table>
</div>
</body>
OUTPUT
Striped Rows
The .table-striped class adds zebra-stripes to a table:
<table class="table table-striped">
Bordered Table
The .table-bordered class adds borders on all sides of the table and cells:
Hover Rows
The .table-hover class adds a hover effect (grey background color) on table rows:
Rounded Corners
The .img-rounded class adds rounded corners to an image (IE8 does not support rounded corners):
Circle
The .img-circle class shapes the image to a circle (IE8 does not support rounded corners):
Thumbnail
The .img-thumbnail class shapes the image to a thumbnail:
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 display: block; and max-width: 100%; and height: auto; to the image:
Button Styles
The button classes can be used on an <a>, <button>, or <input> element:
BUTTON SIZE
Bootstrap provides four button sizes:
• .btn-lg
• .btn-sm
• .btn-xs
Block Level Buttons
A block level button spans the entire width of the parent element.
<div class="container">
<h2>Block Level Buttons</h2>
<button type="button" class="btn btn-primary btn-block">Button 1</button>
<button type="button" class="btn btn-default btn-block">Button 2</button> <h2>Large Block Level Buttons</h2>
<button type="button" class="btn btn-primary btn-lg btn-block">Button 1</button>
<button type="button" class="btn btn-default btn-lg btn-block">Button 2</button>
OUTPUT
Active/Disabled Buttons
A button can be set to an active (appear pressed) or a disabled (unclickable) state:
Button Groups
Bootstrap allows you to group a series of buttons together (on a single line) in a button group:
For <button> elements, you must wrap each button in a .btn-group class:
<div class="btn-group btn-group-justified">
<div class="btn-group">
<button type="button" class="btn btn-primary">Apple</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary">Samsung</button>
</div>
<div class="btn-group">
<button type="button" class="btn btn-primary">Sony</button>
</div>
</div>
Output
Output