slides - Brain Hz Consulting Blog

Download Report

Transcript slides - Brain Hz Consulting Blog

Twitter Bootstrap

Agenda

• • • • • • • • What is it?

Grids and Fluid layouts Globals and Typography Tables, Forms and Buttons Navigation Media and thumbnails Responsive JavaScript plugins

What is Twitter Bootstrap

• • • • • CSS framework Makes creating layouts easier Commonly used set of classes Responsive JavaScript components for UI

Grid and layouts

• • • Based on a 12 column grid system – Divisible by 2 and 3 Easy to create things that line up Fixed or fluid containers and fixed or fluid rows • Recommendation: Always use fluid rows!

– – helps when extracting partials to place in modals (more later) fixed containers are fine for forms •

Important and tricky!

– – In fixed: number of columns in nested rows should add up to the number of columns of its parent.

In fluid: number of columns in nested rows should always add up to 12

Global reset

• • • • • Do a reset via normalize.css

Remove margin on the body Set background-color: white; on the body Use the @baseFontFamily, @baseFontSize, and @baseLineHeight attributes as our typographic base Set the global link color via @linkColor and apply link underlines only on :hover

Typography

• • • • • • • • • font-size is 14px, with a line-height of 20px Use normal headers, b, strong, i, p, etc.

.lead class .text-left, .text-center, .text-warning , .text-error , .text-info , .text-success abbr, address, blockquote ul (.unstyled and .inline) dl, dt, dd (.dl-horizontal) code, pre (.pre-scrollable) .text-right

Tables

• • • For

add a “table” class (.table) – Combine with: – .table-striped, .table-bordered, .table-hover, .table-condensed Supports, s can add – .warning

, .error

, .info

, .success

Forms

• • • • • By default: left-aligned labels on top of form controls Supports

– bold with an underline .form-inline (to stack horizontally) .form-horizontal (for rows) • – – .control-group (like row but with more padding) labels need .control-label (I don’t like this) – align with .controls or .form-actions for buttons Can use .warning

, .error

, .info

, .success on .control-group to change the label, input, and possible help/error

Input

• • • • • • • • • Surround input with

Buttons

• Having clear nice looking buttons greatly increases the usability of your web site • • Can size them in a number of ways – .btn-block, .btn-large, .btn-small, .btn-mini, grid sizing Can be applied to ,

Modal header

Tooltips and Popovers

• Both require a little JavaScript to turn on

Other Controls

• • • • Accordion / Collapse – To allow viewing a single section in multiple sections of content Carousel – To view a collection of images – Requires a line of JavaScript $(“#mycarousel”).carousel() to autostart Typeahead – input but allows autocomplete Affix – Like a sideway intra-page navigation system that auto-updates

Responsive

• • • Additional style sheet needed – Requires you to make decisions about what to see in the various environments Use classes to turn on for specific or hide for specific environments – – .visible-phone, .visible-tablet, .visible-desktop .hidden-phone, .hidden-tablet, .hidden-desktop Can place sections of navbar in .nav-collapse

Summary

• • • Use bootstrap to make your web pages look nice – for demos – while you wait for designers Provide many of the most commonly used “controls” – which conform to the same styles Lavish Bootstrap to customize colors

and