Getting Started with Bootstrap
Here's what you need to include in your web page in order to use Bootstrap.
Bootstrap uses its own CSS and JS files, which you need to link to. You should also add the HTML5 <!DOCTYPE>
as well as add two <meta>
elements.
HTML5 <!DOCTYPE>
Your HTML documents should begin with the HTML5 <!DOCTYPE>
to specify which language and version the document is using. Like this:
Add <meta>
Elements
Viewport
To ensure proper rendering and touch zooming on mobile devices, add the viewport <meta>
tag, like this:
You can (optionally), disable zooming capabilities on mobile devices by adding user-scalable=no
to the list of content
values. However, this is not recommended.
Force Internet Explorer to use its Latest Rendering Mode
The following code forces Internet Explorer to use its latest rendering mode:
CSS & JS Files
You can either download the CSS and JS files from the Bootstrap website, or you can link directly to the files via a CDN (Content Delivery Network).
All Bootstrap plugins use JQuery so you'll need to ensure you're using that too.
You can place these files in the document's <head>
, however, you may wish to place the javascript files at the bottom of your document (just before the end <body>
tag) for performance purposes.
Containers
Bootstrap requires a containing element to wrap elements and contain its grid system (more on the grid system next). Bootstrap's container classes were created specifically for this purpose.
Bootstrap containers can be either fixed or fluid.
Fixed Container
A fixed container is a (responsive) fixed width container. As you resize your browser, its width will remain intact, until it passes a certain breakpoint (as specified by you — more on that next), at which time it will resize to the new width for that break point.
Fluid Container
A fluid container spans the full width of the viewport. It will expand and contract fluidly as you resize the browser. This is in contrast to the fixed width container which will appear to "jump" to the new size as you pass a given break point.
Quick Start: Bootstrap Template
You can use the following template as a basis for your Bootstrap web pages. This template contains the necessary <!DOCTYPE>
preamble, links to CSS and JS files, as well as the viewport <meta>
tag.