Você está na página 1de 24

Lecture 8

E-Commerce and Web


Programming
Course Code
CS-633 3(2-1)
[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]
University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
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 and many other, as
well as optional JavaScript plugins
 Bootstrap also gives you the ability to easily
create responsive designs

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
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.

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
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!

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
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,
Edge, Safari, and Opera)

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
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

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap CDN
 If you don't want to download and host
Bootstrap yourself, you can include it from
a CDN (Content Delivery Network).
 MaxCDN provides CDN support for
Bootstrap's CSS and JavaScript. You must
also include jQuery:

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
 <link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/cs
s/bootstrap.min.css">

<!-- jQuery library -->


<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jq
uery.min.js"></script>

<!-- Latest compiled JavaScript -->


<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/
bootstrap.min.js"></script>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Grid System
 Bootstrap's grid system allows up to 12
columns across the page.
 If you do not want to use all 12 columns
individually, you can group the columns
together to create wider columns:

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap's grid system is responsive, and the columns will re-arrange automatically
depending on the screen size.

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
 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.

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Three Equal Columns
 <div class="row">
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-4">.col-sm-4</div>
</div>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Two Unequal Columns
 <div class="row">
<div class="col-sm-4">.col-sm-4</div>
<div class="col-sm-8">.col-sm-8</div>
</div>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Text/Typography
 <small>
 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>
 <mark>
 Bootstrap will style the HTML <mark> element in the following way:
 <p>Use the mark element to <mark>highlight</mark> text.</p>
 <abbr>
 Bootstrap will style the HTML <abbr> element in the following way:
 <p>The <abbr title="World Health Organization">WHO</abbr> was
founded in 1948.</p>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Tables
 Bootstrap Basic Table
 A basic Bootstrap table has a light padding and only
horizontal dividers.
 The .table class adds basic styling to a table:
 Striped Rows
 The .table-striped class adds zebra-stripes to a table:
 Bordered Table
 The .table-bordered class adds borders on all sides of the
table and cells:

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Images

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
<img src="cinqueterre.jpg" class="img-
rounded" alt="Cinque Terre">
<img src="cinqueterre.jpg" class="img-
circle" alt="Cinque Terre">
<img src="cinqueterre.jpg" class="img-
thumbnail" alt="Cinque Terre">
<img class="img-responsive"
src="img_chania.jpg" alt="Chania">

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Wells
 <div class="well">Basic Well</div>

 <div class="well well-sm">Small


Well</div>
<div class="well well-lg">Large
Well</div>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Alerts
 <div class="alert alert-success">
 <strong>Success!</strong> This alert box could indicate a successful or positive
action.
 </div>
 <div class="alert alert-info">
 <strong>Info!</strong> This alert box could indicate a neutral informative change or
action.
 </div>
 <div class="alert alert-warning">
 <strong>Warning!</strong> This alert box could indicate a warning that might need
attention.
 </div>
 <div class="alert alert-danger">
 <strong>Danger!</strong> This alert box could indicate a dangerous or potentially
negative action.
 </div>
[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]
University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Bootstrap Buttons
 Button Styles
 Bootstrap provides different styles of buttons:

 To achieve the button styles above, Bootstrap has the following classes:
 .btn
 .btn-default
 .btn-primary
 .btn-success
 .btn-info
 .btn-warning
 .btn-danger
 .btn-link

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
<button type="button" class="btn">Basic</button>
<button type="button" class="btn btn-default">Default</button>
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-link">Link</button>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Button Sizes
 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:

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
 <button type="button" class="btn btn-primary
btn-lg">Large</button>
<button type="button" class="btn btn-primary
btn-md">Medium</button>
<button type="button" class="btn btn-primary
btn-sm">Small</button>
<button type="button" class="btn btn-primary
btn-xs">XSmall</button>

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari
Any Question???

[CS-633:Web Programming] [Engr. M. Shakeel] [www.uaf-cms.weebly.com]


University of Agriculture , Faisalabad  UAF Sub Campus Burewala , Vehari

Você também pode gostar