bootstrap study share

31
Bootstrap v3 研究分享 by Vincent Chang

Upload: vincent-chang

Post on 27-Jan-2015

104 views

Category:

Technology


0 download

DESCRIPTION

Bootstrap investigation.

TRANSCRIPT

Page 1: Bootstrap Study Share

Bootstrap v3 研究分享 by Vincent Chang

Page 2: Bootstrap Study Share

Agenda

Bootstrap

◦ CSS

◦ Component

◦ UI Customization

Responsive Web Design(RWD)

Less

Reference

Page 3: Bootstrap Study Share

BOOTSTRAP

Page 4: Bootstrap Study Share

Bootstrap v3 HTML5

◦ <!DOCTYPE html>

CSS ◦ CSS3

◦ Grid System

◦ Normalize.css, a project by Nicolas Gailagher and Jonathan Neal

◦ LESS

Components ◦ A dozen reusable components

◦ Glyphicons

JavaScript ◦ Uses jQuery framework

◦ The data attribute

Page 5: Bootstrap Study Share

Bootstrap Grid System

12 columns

Size

◦ Extra small(col-xs) : (<768px)

◦ Small(col-sm) : (≥768px)

◦ Middle(col-md) : (≥992px)

◦ Large(col-lg) : (≥1200px)

Grid behavior: ◦ Extra small : Horizontal at all times

◦ Others : Collapsed to start, horizontal above breakpoints

Page 6: Bootstrap Study Share

Bootstrap Grid System

Include Bootstrap.css

Usage

◦ Row : row as the div class name

◦ Column : (col-xs-/col-sm-/col-md-/col-lg-)%d as the div class name

Col-md-6 Col-md-6

Page 7: Bootstrap Study Share

Grid system sample

Page 8: Bootstrap Study Share

Normalize.css

Cross-browser consistency in HTML elements

margin => 0 border => 0 padding => 0

Page 9: Bootstrap Study Share

Bootstrap Components

Pre-define a couple of components ◦ Dropdowns ◦ Button, Button Groups ◦ Navbar ◦ Labels ◦ Progress bars ◦ Alerts ◦ Etc.

Component usage: 1. Apply style 2. Enable component logic Via javascript. Via markup API

Page 10: Bootstrap Study Share

Via javascript(Model)

Example

◦ Modal

$('#myModal').modal(‘show’)

$('#myModal').modal({backdrop:’static’, show:true})

◦ Button

$('.btn').button()

◦ Tooltip

$('#example').tooltip(options)

Page 11: Bootstrap Study Share

Via markup API(Modal)

Page 12: Bootstrap Study Share

GlyphIcons

Page 13: Bootstrap Study Share

GlyphIcons

Usage :

◦ <span class="glyphicon glyphicon-star"></span>

◦ Don't mix with other components

X:<button class=“btn glyphicon glyphicon-star”>button</button>

O:<button class=“btn”><span class=“glyphicon xxx”></span>button<button>

Page 14: Bootstrap Study Share

Bootstrap UI Customization

All UI style sheet can be set on official website

http://bootswatch.com/

CSS part

◦ Able to be included partially.

Javascript/jQuery plugin part

◦ Able to be included partially.

Less Variables

Page 15: Bootstrap Study Share

RESPONSIVE WEB DESIGN

Desktop, Tablet, Mobile and etc.

Page 16: Bootstrap Study Share

Responsive Web Design

Fluid Grid Concept

Flexible Image

Media Queries

Page 17: Bootstrap Study Share

Responsive, Fluid Grid Concept Grid system

◦ Is derived from the graphic design.

◦ Make alignment.

◦ Standardize layout design.

◦ 960 Grid system

Fluid Grid

◦ Web design

Page 18: Bootstrap Study Share

12 grid

Page 19: Bootstrap Study Share

12 grid

Page 20: Bootstrap Study Share

Flexible Image

CSS

◦ max-width: 100%; height: auto;

Bootstrap way

◦ class .img-responsive

Page 21: Bootstrap Study Share

Media Queries

a feature of CSS3

E.g.

Bootstrap responsive utilities ◦ .visible-(xs/sm/md/lg)

◦ .hidden-(xs/sm/md/lg)

◦ .visible-print

◦ .hidden-print

Page 22: Bootstrap Study Share

CSS3 Media Queries Browser Support Desktop platform : doesn’t

support IE 8

Mobile platform : support all browsers.

Reference : http://caniuse.com/css-mediaqueries

Page 23: Bootstrap Study Share
Page 24: Bootstrap Study Share

LESS The dynamic stylesheet language

Page 25: Bootstrap Study Share

What is LESS

CSS extension

.LESS files compile to CSS files

Variable

Mixin

Nested Rules

Functions & Operations

Page 26: Bootstrap Study Share

Variables

Page 27: Bootstrap Study Share

Mixin

Page 28: Bootstrap Study Share

Nested Rules

Page 29: Bootstrap Study Share

Functions

String Misc List Math Type Color Color Definition Color Channel Color Operations Color Blending Reference : less functions

Page 30: Bootstrap Study Share

Function example

Page 31: Bootstrap Study Share

Reference

Bootstrap website :

◦ http://getbootstrap.com/

◦ http://bootswatch.com/

◦ http://www.layoutit.com/

LESS : http://www.lesscss.org/

RWD Wiki : http://en.wikipedia.org/wiki/Responsive_web_design