Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
13 views12 pages

EXPT3 Bootstrap

Uploaded by

Nachiket Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views12 pages

EXPT3 Bootstrap

Uploaded by

Nachiket Patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Experiment No: 3

Date of Performance:​ ​
Date of Submission:

Aim:
Bootstrap: Bootstrap Grid system, Forms, Button, Navbar, Breadcrumb, Jumbotron

Theory:

●​ 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.
●​ 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 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!

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, Edge, Safari, and Opera)

Bootstrap 5 is the newest version of Bootstrap; with new components, faster style sheets, more
responsiveness etc. It supports the latest, stable releases of all major browsers and platforms.
However, Internet Explorer 11 and down is not supported.

The main differences between Bootstrap 5 and Bootstrap 3 & 4, is that Bootstrap 5 has switched
to JavaScript instead of jQuery.

Where to Get Bootstrap?

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

●​ Download Bootstrap from getbootstrap.com


●​ Include Bootstrap from a CDN
Bootstrap Grid System

●​ It allows up to 12 columns across the page.


●​ If developer does not want to use all 12 columns individually, he/she 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:
●​ xs (for phones - screens less than 768px wide)
●​ sm (for tablets - screens equal to or greater than 768px wide)
●​ md (for small laptops - screens equal to or greater than 992px wide)
●​ lg (for laptops and desktops - screens equal to or greater than 1200px wide)​

The classes above can be combined to create more dynamic and flexible layouts.
●​ Bootstrap's global default font-size is 14px, with a line-height of 1.428.
●​ This is applied to the <body> element and all paragraphs (<p>).
●​ In addition, all <p> elements have a bottom margin that equals half their computed
line-height (10px by default).

Programs: Executed on OneCompiler.com

Program on Responsive web design:


<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<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-8" style="background-color:lavenderblush;">.col-sm-8</div>
</div>
</div>
</body>
</html>
Output:

Program on Responsive web design:


<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<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>
</body>
</html>
Output:
Program on Header Settings:
<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h1>h1 Bootstrap heading (36px)</h1>
<h2>h2 Bootstrap heading (30px)</h2>
<h3>h3 Bootstrap heading (24px)</h3>
<h4>h4 Bootstrap heading (18px)</h4>
<h5>h5 Bootstrap heading (14px)</h5>
<h6>h6 Bootstrap heading (12px)</h6>
</div>
</body>
</html>
Output:​

In Bootstrap the HTML <small> element is used to create a lighter, secondary text in any
heading:
<h1>h1 heading <small>secondary text</small></h1>
<h2>h2 heading <small>secondary text</small></h2>
<h3>h3 heading <small>secondary text</small></h3>
<h4>h4 heading <small>secondary text</small></h4>
<h5>h5 heading <small>secondary text</small></h5>
<h6>h6 heading <small>secondary text</small></h6>
Output:
<div class="container">
<h1>Highlight Text</h1>
<p>Use the mark element to <mark>highlight</mark> text.</p>
</div>
Output:

<div class="container">
<h1>Abbreviations</h1>
<p>The abbr element is used to mark up an abbreviation or acronym:</p>
<p>The <abbr title="World Health Organization">WHO</abbr> was founded in
1948.</p>
</div>

Output:

●​ 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 <div> element with class .jumbotron to create a Jumbotron

<body>
<div class="container">
<div class="jumbotron">
<h1>Bootstrap Tutorial</h1>
<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive,
mobile-first projects on the web.</p>
</div>
<p>This is some text.</p>
<p>This is another text.</p>
</div>
</body>

Output:

Navigation Bar is a navigation header that is placed at the top of the page:

<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>

<nav class="navbar navbar-default">


<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="#">Home</a></li>
<li><a href="#">Page 1</a></li>
<li><a href="#">Page 2</a></li>
<li><a href="#">Page 3</a></li>
</ul>
</div>
</nav>
<div class="container">
<h3>Basic Navbar Example</h3>
<p>A navigation bar is a navigation header that is placed at the top of the page.</p>
</div>
</body>
</html>

Output:

Program on Button:
<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Button Tags</h2>
<a href="#" class="btn btn-info" role="button">Link Button</a>
<button type="button" class="btn btn-info">Button</button>
<input type="button" class="btn btn-info" value="Input Button">
<input type="submit" class="btn btn-info" value="Submit Button">
</div>
</body>
</html>

Output:

<body>
<div class="container">
<h2>Button Group</h2>
<p>The .btn-group class creates a button group:</p>
<div class="btn-group">
<button type="button" class="btn btn-primary">Apple</button>
<button type="button" class="btn btn-primary">Samsung</button>
<button type="button" class="btn btn-primary">Sony</button>
</div>
</div>
</body>
Output:

<div class="btn-group-vertical">​
<button type="button" class="btn btn-primary">Apple</button>​
<button type="button" class="btn btn-primary">Samsung</button>​
<button type="button" class="btn btn-primary">Sony</button>​
</div>

<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>
Bootstrap Forms

Bootstrap provides three types of form layouts:
●​ Vertical form (this is default)
●​ Horizontal form
●​ Inline form

Standard rules for all three form layouts:
●​ Wrap labels and form controls in <div class="form-group"> (needed for optimum
spacing)
●​ Add class .form-control to all textual <input>, <textarea>, and <select> elements

Bootstrap Vertical Form (default)


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

Program on Forms:​
<!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="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Vertical (basic) form</h2>
<form action="/action_page.php">
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" ​
name="email">
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" placeholder="Enter password" ​
name="pwd">
</div>
<div class="checkbox">
<label><input type="checkbox" name="remember"> Remember me</label>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
</body>
</html>
Output:

Bootstrap Inline Form


<form class="form-inline" action="/action_page.php">

Output:

Bootstrap Horizontal Form


<form class="form-horizontal" action="/action_page.php">​
<div class="form-group">​
<label class="control-label col-sm-2" for="email">Email:</label>​
<div class="col-sm-10">​
<input type="email" class="form-control" id="email" placeholder="Enter email">​
</div>​
</div>​
<div class="form-group">​
<label class="control-label col-sm-2" for="pwd">Password:</label>​
<div class="col-sm-10">​
<input type="password" class="form-control" id="pwd" placeholder="Enter password">​
</div>​
</div>​
<div class="form-group">​
<div class="col-sm-offset-2 col-sm-10">​
<div class="checkbox">​
<label><input type="checkbox"> Remember me</label>​
</div>​
</div>​
</div>​
<div class="form-group">​
<div class="col-sm-offset-2 col-sm-10">​
<button type="submit" class="btn btn-default">Submit</button>​
</div>​
</div>​
</form>
Output:

Conclusion:

Depending on how you describe your CSS, code uniformity and consistency may become an
issue; but by using a CSS framework like Bootstrap, it is possible to create a website that is
quick and easy to maintain. Bootstrap's great appeal is that it has abundant functionalities and
components that incorporate the latest website trends. Developer creates a wireframe out of
website which he often visits and then tries and rebuilds it from scratch using Bootstrap. This is a
great method for learning the framework and website development.

MARKS & SIGNATURE:


R1 ​ R2 ​ R3​ R4 ​ Total ​ Signature
(3 Marks) (5 Marks) (4 Marks) (3 Marks) (15 Marks)

You might also like