Bootstrap
Bootstrap
A Quick Introduction
getbootstrap.com/getting-started#download
<link href="css/bootstrap.css"
rel="stylesheet">
<link href="css/me.css" rel="stylesheet">
width=device-width
Tells browser that the website adapts to the browser’s
width, so the width of the viewport should be equal to
the width of the device
initial-scale=1
Sets the initial zoom level: 1 CSS pixel is equal to 1
viewport pixel, ergo, do not zoom
<link href="css/bootstrap.min.css"
rel="stylesheet">
bootstrap.min.css
What’s minification?
We don’t need the minified version, so change it to:
<link href="css/bootstrap.css"
rel="stylesheet">
<!-- HTML5 Shim and Respond.js IE8 support of
HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you
view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/
html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/
respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
If you need to support IE before version 9, keep
Otherwise, toss it
<!-- jQuery (necessary for Bootstrap's
JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/
libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or
include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
Remove the comments, but leave the JavaScript, or
things will break
<script src="https://ajax.googleapis.com/ajax/libs/
jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
</head>
So, your <head> should now look like this…
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible"
content="IE=edge">
<meta name="viewport" content="width=device-
width, initial-scale=1">
<title>Bootstrap 101 Template</title>
<link href="css/bootstrap.css"
rel="stylesheet">
<link href="css/scott.css" rel="stylesheet">
</head>
And your <body> like this…
<body>
<h1>Hello, world!</h1>
<script src="https://ajax.googleapis.com/
ajax/libs/jquery/1.11.2/jquery.min.js"></
script>
<script src=“js/bootstrap.js"></script>
</body>
Grid System
Content (e.g., text & images) goes inside elements with
CSS classes (e.g., col-md-8) that turn those elements
into columns & define…
<div class="container">
...
</div>
<div class="container">
<article class="row">
…
</article>
<aside class="row">
…
</aside>
</div>
The container element can have other children
besides row elements
Columns
Columns
Remember those 12 columns that Bootstrap uses?
class="col-md-6" .col-md-6 {}
class="col-sm-6" .col-sm-6 {}
class="col-xs-6" .col-xs-6 {}
Bootstrap is mobile-first
» 12 columns
which is the same as…
» 100% width
which is the same as…
» full width
lg The lg column inherits the size of the md column
Bootstrap is mobile-first
Because the default width of a column is 12 (unless
overridden) & because column sizes are inherited from
xs up to lg, this would be unnecessary:
<div class="col-md-8">
Size Name Device Column Width
Extra Small (xs) Phones Fluid
Small (sm) Tablets 60px
Medium (md) Tablets in portrait 78px
& desktops
Large (lg) Desktops 95px
So I made one
Excellent service
www.browserstack.com
Bootstrap 4
Sass instead of Less
[email protected]
www.granneman.com
ChainsawOnATireSwing.com
@scottgranneman
[email protected]
websanity.com
Bootstrap
A Quick Introduction
Attribution. You must give appropriate credit, provide a link to the license, and indicate if changes were made.
You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your
use. Give credit to:
Share Alike. If you remix, transform, or build upon the material, you must distribute your contributions under
the same license as the original.
No additional restrictions. You may not apply legal terms or technological measures that legally restrict others
from doing anything the license permits.