css.html 78.75 KiB
---
layout: default
title: CSS
slug: css
lead: "Global CSS settings, fundamental HTML elements styled and enhanced with extensible classes, and an advanced grid system."
---
  <!-- Global Bootstrap settings
  ================================================== -->
  <div class="bs-docs-section" id="overview">
    <div class="page-header">
      <h1>Overview</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 id="overview-doctype">HTML5 doctype required</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 %}
<!DOCTYPE html>
<html lang="en">
  ...
</html>
{% endhighlight %}
    <h3 id="overview-mobile">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>&lt;head&gt;</code>.</p>
{% highlight html %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% endhighlight %}
    <h3 id="overview-type-links">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>
      <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 id="overview-normalize">Normalize reset</h3>
    <p>For improved cross-browser rendering, we use <a href="http://necolas.github.io/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>
    <h3 id="overview-container">Centering with container</h3>
    <p>Easily center a page's contents by wrapping its contents in a container. Containers set <code>max-width</code> at various media query breakpoints to match our grid system.</p>
{% highlight html %}
<div class="container">
  ...
</div>
{% endhighlight %}
  </div>
  <!-- Glyphicons icon font
  ================================================== -->
  <div class="bs-docs-section" id="glyphicons">
    <div class="page-header">
      <h1>Glyphicons</h1>
    </div>
    <p class="lead">With the launch of Bootstrap 3, icons have been moved to a <a href="https://github.com/twbs/bootstrap-glyphicons">separate repository</a>. This keeps the primary project as lean as possible, makes it easier for folks to swap icon libraries, and makes Glyphicons icon fonts more readily available to more people outside Bootstrap.</p>
    <p class="lead">
      <a href="http://glyphicons.getbootstrap.com/" class="btn btn-default btn-large">Visit Glyphicons for Bootstrap</a> or <a href="https://github.com/twbs/bootstrap-glyphicons">download from GitHub</a>
    </p>
  </div>