Meta name= viewport content= width=device-width initial-scale=1 la gi

Get the lowdown on the key pieces of Bootstrap's infrastructure, including our approach to better, faster, stronger web development.

HTML5 doctype

Bootstrap makes use of certain HTML elements and CSS properties that require the use of the HTML5 doctype. Include it at the beginning of all your projects.



  ...

Mobile first

With Bootstrap 2, we added optional mobile friendly styles for key aspects of the framework. With Bootstrap 3, we've rewritten the project to be mobile friendly from the start. Instead of adding on optional mobile styles, they're baked right into the core. In fact, Bootstrap is mobile first. Mobile first styles can be found throughout the entire library instead of in separate files.

To ensure proper rendering and touch zooming, add the viewport meta tag to your .

You can disable zooming capabilities on mobile devices by adding user-scalable=no to the viewport meta tag. This disables zooming, meaning users are only able to scroll, and results in your site feeling a bit more like a native application. Overall, we don't recommend this on every site, so use caution!

Typography and links

Bootstrap sets basic global display, typography, and link styles. Specifically, we:

  • Set background-color: #fff; on the body
  • Use the @font-family-base, @font-size-base, and @line-height-base attributes as our typographic base
  • Set the global link color via @link-color and apply link underlines only on :hover

These styles can be found within scaffolding.less.

Normalize.css

For improved cross-browser rendering, we use Normalize.css, a project by Nicolas Gallagher and Jonathan Neal.

Containers

Bootstrap requires a containing element to wrap site contents and house our grid system. You may choose one of two containers to use in your projects. Note that, due to padding and more, neither container is nestable.

Use .container for a responsive fixed width container.


  ...

Use .container-fluid for a full width container, spanning the entire width of your viewport.


  ...

Bootstrap includes a responsive, mobile first fluid grid system that appropriately scales up to 12 columns as the device or viewport size increases. It includes predefined classes for easy layout options, as well as powerful mixins for generating more semantic layouts.

Introduction

Grid systems are used for creating page layouts through a series of rows and columns that house your content. Here's how the Bootstrap grid system works:

Look to the examples for applying these principles to your code.

We use the following media queries in our Less files to create the key breakpoints in our grid system.

/* Extra small devices [phones, less than 768px] */
/* No media query since this is the default in Bootstrap */

/* Small devices [tablets, 768px and up] */
@media [min-width: @screen-sm-min] { ... }

/* Medium devices [desktops, 992px and up] */
@media [min-width: @screen-md-min] { ... }

/* Large devices [large desktops, 1200px and up] */
@media [min-width: @screen-lg-min] { ... }

We occasionally expand on these media queries to include a max-width to limit CSS to a narrower set of devices.

@media [max-width: @screen-xs-max] { ... }
@media [min-width: @screen-sm-min] and [max-width: @screen-sm-max] { ... }
@media [min-width: @screen-md-min] and [max-width: @screen-md-max] { ... }
@media [min-width: @screen-lg-min] { ... }

Grid options

See how aspects of the Bootstrap grid system work across multiple devices with a handy table.

Extra small devices Phones [

Chủ Đề