Wednesday, August 27, 2014

Introduction

Bootstrap File Structure

bootstrap/
├── css/
│ ├── bootstrap.css
│ ├── bootstrap.min.css
├── js/
│ ├── bootstrap.js
│ ├── bootstrap.min.js
├── img/
│ ├── glyphicons-halflings.png
│ ├── glyphicons-halflings-white.png
└── README.md

<!DOCTYPE html>
<html>
  <head>
       <title>Bootstrap 101 Template</title>
       <link href="css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body>
       <h1>Hello, world!</h1>
       <script src="js/bootstrap.min.js"></script>
   </body>
</html>

Default Grid System


Basic Grid HTML

spans should add up to 12

<div class="row">
    <div class="span8">...</div>
    <div class="span4">...</div>
</div>

<div class="row">
    <div class="span3">...</div>
    <div class="span5">...</div>
    <div class="span4">...</div>
</div>

Offsetting Columns

<div class="row">
    <div class="span2">...</div>
    <div class="span7 offset2">...</div>
</div>

moves span7 over two columns

Nesting Columns



Fluid Grid System



Container Layouts


Responsive Design

To turn on the responsive features of Bootstrap, you need to add a <meta> tag to the <head> of your web page

<!DOCTYPE html>
<html>
    <head>
        <title>My amazing Bootstrap site!</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link href="/css/bootstrap.css" rel="stylesheet">
        <link href="/css/bootstrap-responsive.css" rel="stylesheet">
    </head>


Responsive Design

Responsive design is a method for taking all of the existing content that is on the page and optimizing it for the device that is viewing it

Bootstrap uses CSS media queries to measure the width of the browser viewport and then, using conditionals, changes which parts of the stylesheets are loaded


/* Large desktop */
      @media (min-width: 1200px) { ... }
/* Portrait tablet to landscape and desktop */
      @media (min-width: 768px) and (max-width: 979px) { ... }
/* Landscape phone to portrait tablet */
      @media (max-width: 767px) { ... }
/* Landscape phones and down */
      @media (max-width: 480px) { ... }

Helper classes



No comments:

Post a Comment