An error occurred while loading the file. Please try again.
-
Jon Stevens authored117f65d4
---
layout: default
title: CSS
---
<!-- Subhead
================================================== -->
<header class="bs-docs-jumbotron subhead">
<div class="container">
<h1>CSS</h1>
<p class="lead">Fundamental HTML elements styled and enhanced with extensible classes.</p>
</div>
</header>
<div class="container bs-docs-container">
<!-- Docs nav
================================================== -->
<div class="row">
<div class="col-span-3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav">
<li><a href="#global"><i class="glyphicon glyphicon-chevron-right"></i> Global settings</a></li>
<li><a href="#grid"><i class="glyphicon glyphicon-chevron-right"></i> Grid system</a></li>
<li><a href="#typography"><i class="glyphicon glyphicon-chevron-right"></i> Typography</a></li>
<li><a href="#code"><i class="glyphicon glyphicon-chevron-right"></i> Code</a></li>
<li><a href="#tables"><i class="glyphicon glyphicon-chevron-right"></i> Tables</a></li>
<li><a href="#forms"><i class="glyphicon glyphicon-chevron-right"></i> Forms</a></li>
<li><a href="#buttons"><i class="glyphicon glyphicon-chevron-right"></i> Buttons</a></li>
<li><a href="#images"><i class="glyphicon glyphicon-chevron-right"></i> Images</a></li>
<li><a href="#icons"><i class="glyphicon glyphicon-chevron-right"></i> Glyphicons</a></li>
<li><a href="#responsive-utilities"><i class="glyphicon glyphicon-chevron-right"></i> Responsive utilities</a></li>
</ul>
</div>
<div class="col-span-9">
<!-- Global Bootstrap settings
================================================== -->
<section id="global">
<div class="page-header">
<h1>Global settings</h1>
</div>
<p class="lead">Get the lowdown on the key pieces of Bootstrap's infrastructure, including our approach to better, faster, stronger web development.</p>
<h3>Requires HTML5 doctype</h3>
<p>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.</p>
{% highlight html linenos %}
<!DOCTYPE html>
<html lang="en">
...
</html>
{% endhighlight %}
<h3>Mobile first</h3>
<p>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, <strong>Bootstrap is mobile first</strong>. Mobile first styles can be found throughout the entire library instead of in separate files.</p>
<p>To ensure proper rendering and touch zooming, <strong>add the viewport meta tag</strong> to your <code><head></code>.</p>
{% highlight html linenos %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% endhighlight %}
<h3>Typography and links</h3>
<p>Bootstrap sets basic global display, typography, and link styles. Specifically, we:</p>
<ul>
<li>Remove <code>margin</code> on the body</li>
<li>Set <code>background-color: white;</code> on the <code>body</code></li>
<li>Use the <code>@font-family-base</code>, <code>@font-size-base</code>, and <code>@line-height-base</code> attributes as our typographic base</li>
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
<li>Set the global link color via <code>@link-color</code> and apply link underlines only on <code>:hover</code></li>
</ul>
<p>These styles can be found within <strong>scaffolding.less</strong>.</p>
<h3>Normalize reset</h3>
<p>For improved cross-browser rendering, we use <a href="http://necolas.github.com/normalize.css/" target="_blank">Normalize</a>, a project by <a href="http://twitter.com/necolas" target="_blank">Nicolas Gallagher</a> and <a href="http://twitter.com/jon_neal" target="_blank">Jonathan Neal</a>.</p>
</section>
<!-- Grid system
================================================== -->
<section id="grid">
<div class="page-header">
<h1>Grid system</h1>
</div>
<p class="lead">Bootstrap includes a responsive, percent-based grid system that appropriately scales up to 12 columns as the device or viewport size increases—in other words, it's mobile first. It includes <a href="#grid-example">predefined classes</a> for this, as well as powerful <a href="#grid-less">mixins for generating semantic layouts</a>.</p>
<h3 id="grid-example">Grid example</h3>
<p>On mobile devices, the grid starts out stacked. Above 768px, it becomes horizontal as media queries kick in to apply <code>float</code>s and <code>width</code>s. To create a basic grid layout, wrap a series of <code>.col-span-*</code> elements within a <code>.row</code>. As this is a 12-column grid, each <code>.span*</code> spans a number of those 12 columns, and should always add up to 12 for each row (or the number of columns in the parent), even at mobile resolutions.</p>
<div class="bs-docs-grid">
<div class="row show-grid">
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
</div>
<div class="row show-grid">
<div class="col-span-4">4</div>
<div class="col-span-4">4</div>
<div class="col-span-4">4</div>
</div>
<div class="row show-grid">
<div class="col-span-6">6</div>
<div class="col-span-6">6</div>
</div>
</div>
{% highlight html linenos %}
<div class="row">
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
<div class="col-span-1">1</div>
</div>
<div class="row">
<div class="col-span-4">4</div>
<div class="col-span-4">4</div>
<div class="col-span-4">4</div>
</div>
<div class="row">
<div class="col-span-6">6</div>
<div class="col-span-6">6</div>
</div>