html & css #10 : bootstrap

32
Bootstrap

Upload: jean-michel

Post on 27-Jul-2015

93 views

Category:

Software


0 download

TRANSCRIPT

Page 1: HTML & CSS #10 : Bootstrap

Bootstrap

Page 2: HTML & CSS #10 : Bootstrap

1. Bootstrap ?

Page 3: HTML & CSS #10 : Bootstrap

What ?

« Bootstrap is the most popular HTML, CSS, and JS framework

for developing responsive, mobile first projects on the web. »

http://getbootstrap.com

Page 4: HTML & CSS #10 : Bootstrap

Framework ?

A software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.http://en.wikipedia.org

Page 5: HTML & CSS #10 : Bootstrap

Mobile first ?

« Adapting the design process to start by designing the mobile

version of an application first and then going upwards. »

Page 6: HTML & CSS #10 : Bootstrap

Most popular ?

Source Google Trends

Page 7: HTML & CSS #10 : Bootstrap

The story

Jacob Thornton Mark Otto Twitter

+ +

Page 8: HTML & CSS #10 : Bootstrap

2. Why Bootstrap ?

Page 9: HTML & CSS #10 : Bootstrap

Save time“All we have to decide is what to do with the time that is given us.” - Gandalf

Page 10: HTML & CSS #10 : Bootstrap

Customization« Design is not just what it looks like and feels like. Design is how it works. » - Steve Jobs

Page 11: HTML & CSS #10 : Bootstrap

Consistency« Trust is built with consistency. » Lincoln Chafee

Page 12: HTML & CSS #10 : Bootstrap

Responsiveness« Adapt or perish, now as ever, is nature's inexorable imperative. » - H. G. Wells

Page 13: HTML & CSS #10 : Bootstrap

3. Getting started

Page 14: HTML & CSS #10 : Bootstrap

Download http://getbootstrap.com/getting-started/#download

Page 15: HTML & CSS #10 : Bootstrap

Basic template<!DOCTYPE html> <html lang="en"> <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.min.css" rel="stylesheet">

<!--[if lt IE 9]> <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script> <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> <![endif]--> </head> <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.min.js"></script> </body> </html>

Page 16: HTML & CSS #10 : Bootstrap

Exemples template

http://getbootstrap.com/getting-started/#examples

Page 17: HTML & CSS #10 : Bootstrap

4. Grid system

Page 18: HTML & CSS #10 : Bootstrap

Containers (1)

« Bootstrap requires a containing element to wrap site contents and house our grid system. »

http://getbootstrap.com/css/#overview-container

Page 19: HTML & CSS #10 : Bootstrap

Containers (2)

<div class="container"> ... </div>

<div class="container-fluid"> ... </div>

Fixed width Full width

Page 20: HTML & CSS #10 : Bootstrap

Rows (1)

« Use rows to create horizontal groups of columns. »

http://getbootstrap.com/css/#grid-intro

Page 21: HTML & CSS #10 : Bootstrap

Rows (2)

Rows must be placed within a .container or .container-fluid for proper alignment and padding.

Only columns may be immediate children of rows

Page 22: HTML & CSS #10 : Bootstrap

Rows (3)

<div class="container"> <div class="row">...</div> <div class="row">...</div> <div class="row">...</div> </div>

Page 23: HTML & CSS #10 : Bootstrap

Columns (1)

« Bootstrap includes a responsive, mobile first fluid grid system that

appropriately scales up to 12 columns as the device or viewport size increases »

http://getbootstrap.com/css/#grid-intro

Page 24: HTML & CSS #10 : Bootstrap

Columns (2)

Content should be placed within columns

Grid columns are created by specifying the number of twelve available columns you wish to span.

Grid classes apply to devices with screen widths greater than or equal to the breakpoint sizes

Page 25: HTML & CSS #10 : Bootstrap

Columns (3)

http://getbootstrap.com/css/#grid-options

Page 26: HTML & CSS #10 : Bootstrap

Columns (4)

<div class="container"> <div class="row"> <div class="col-md-8">.col-md-8</div> <div class="col-md-4">.col-md-4</div> </div> <div class="row"> <div class="col-md-4">.col-md-4</div> <div class="col-md-4">.col-.md-4</div> <div class="col-md-4">.col-md-4</div> </div> <div class="row"> <div class="col-md-6">.col-md-6</div> <div class="col-md-6">.col-md-6</div> </div> </div>

Page 27: HTML & CSS #10 : Bootstrap

Columns (5)

<div class="container"> <div class="row"> <div class="col-xs-12 col-md-8">.col-xs-12 .col-md-8</div> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> </div>

<div class="row"> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> <div class="col-xs-6 col-md-4">.col-xs-6 .col-md-4</div> </div>

<div class="row"> <div class="col-xs-6">.col-xs-6</div> <div class="col-xs-6">.col-xs-6</div> </div> </div>

Page 28: HTML & CSS #10 : Bootstrap

4. Customize

Page 29: HTML & CSS #10 : Bootstrap

NEVER, EVER modify the bootstrap.css file

Every time you hack bootstrap files God kills a kitten

Page 30: HTML & CSS #10 : Bootstrap

Add a Custom Stylesheet

<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.min.css" rel="stylesheet"> <link rel="stylesheet" type="text/css" href="css/custom.css">

</head>

Page 31: HTML & CSS #10 : Bootstrap

Applying Custom Styles

h1{ color: red; }

Page 32: HTML & CSS #10 : Bootstrap

Merci pour votre attention.