diff options
Diffstat (limited to 'docs/getting-started.html')
| -rw-r--r-- | docs/getting-started.html | 624 |
1 files changed, 269 insertions, 355 deletions
diff --git a/docs/getting-started.html b/docs/getting-started.html index c798670f8..018c8ed0a 100644 --- a/docs/getting-started.html +++ b/docs/getting-started.html @@ -1,375 +1,289 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - <title>Getting · Bootstrap</title> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <meta name="description" content=""> - <meta name="author" content=""> - - <!-- Le styles --> - <link href="assets/css/bootstrap.css" rel="stylesheet"> - <link href="assets/css/bootstrap-responsive.css" rel="stylesheet"> - <link href="assets/css/docs.css" rel="stylesheet"> - <link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet"> - - <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements --> - <!--[if lt IE 9]> - <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> - <![endif]--> - - <!-- Le fav and touch icons --> - <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png"> - <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png"> - <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png"> - <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png"> - <link rel="shortcut icon" href="assets/ico/favicon.png"> +--- +layout: default +title: Getting started +slug: getting-started +lead: "An overview of Bootstrap, how to download and use, basic templates and examples, and more." +--- + + + <!-- Getting started + ================================================== --> + <div class="bs-docs-section" id="download"> + <div class="page-header"> + <h1>Download Bootstrap</h1> + </div> + <p class="lead">There are a few easy ways to quickly get started with Bootstrap, each one appealing to a different skill level and use case. Read through to see what suits your particular needs.</p> + + <h3>Download compiled CSS and JS</h3> + <p class="lead">The fastest way to get started is to get the compiled and minified versions of our CSS, JavaScript, and fonts. No documentation or original source files are included.</p> + <p><a class="btn btn-large btn-primary" href="assets/bootstrap.zip" onclick="_gaq.push(['_trackEvent', 'Getting started', 'Download', 'Download compiled']);">Download Bootstrap</a></p> + + <hr> + + <h3 id="download-options">More download options</h3> + <div class="bs-docs-dl-options"> + <h4> + <a href="https://github.com/twitter/bootstrap/zipball/master" onclick="_gaq.push(['_trackEvent', 'Getting started', 'Download', 'Download source']);">Download latest source code</a> + </h4> + <p>Get the original files for all CSS and JavaScript by downloading the latest version directly from GitHub.</p> + <h4> + <a href="https://github.com/twitter/bootstrap/" onclick="_gaq.push(['_trackEvent', 'Getting started', 'Download', 'GitHub project']);">Clone or fork via GitHub</a> + </h4> + <p>Clone the entire project or fork your own version of Bootstrap to make it your own by visiting us on GitHub.</p> + <h4> + Install with <a href="http://twitter.github.com/bower">Bower</a> + </h4> + <p>Install and manage the original files for all CSS and JavaScript, along with a local copy of the docs, using <a href="http://twitter.github.com/bower">Bower</a>.</p> + {% highlight bash %}$ bower install bootstrap{% endhighlight %} + </div> - </head> + <hr> - <body data-spy="scroll" data-target=".bs-docs-sidebar"> - - <!-- Navbar - ================================================== --> - <div class="navbar navbar-inverse navbar-fixed-top"> - <div class="navbar-inner"> - <div class="container"> - <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a class="brand" href="./index.html">Bootstrap</a> - <div class="nav-collapse collapse"> - <ul class="nav"> - <li class=""> - <a href="./index.html">Home</a> - </li> - <li class="active"> - <a href="./getting-started.html">Get started</a> - </li> - <li class=""> - <a href="./scaffolding.html">Scaffolding</a> - </li> - <li class=""> - <a href="./base-css.html">Base CSS</a> - </li> - <li class=""> - <a href="./components.html">Components</a> - </li> - <li class=""> - <a href="./javascript.html">JavaScript</a> - </li> - <li class=""> - <a href="./customize.html">Customize</a> - </li> - </ul> - </div> - </div> - </div> - </div> + <h3 id="download-cdn">Use the Bootstrap CDN</h3> + <p>The folks over at <a href="https://www.netdna.com/">NetDNA</a> have graciously provided CDN support for Bootstrap's CSS and JavaScript. To use, swap your local instances for the <a href="http://www.bootstrapcdn.com/">Bootstrap CDN</a> links listed below.</p> +{% highlight html linenos %} +<!-- Latest compiled and minified CSS --> +<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"> -<!-- Subhead -================================================== --> -<header class="jumbotron subhead" id="overview"> - <div class="container"> - <h1>Getting started</h1> - <p class="lead">Overview of the project, its contents, and how to get started with a simple template.</p> +<!-- Latest compiled and minified JavaScript --> +<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> +{% endhighlight %} </div> -</header> - - - <div class="container"> - - <!-- Docs nav - ================================================== --> - <div class="row"> - <div class="span3 bs-docs-sidebar"> - <ul class="nav nav-list bs-docs-sidenav"> - <li><a href="#download-bootstrap"><i class="icon-chevron-right"></i> Download</a></li> - <li><a href="#file-structure"><i class="icon-chevron-right"></i> File structure</a></li> - <li><a href="#contents"><i class="icon-chevron-right"></i> What's included</a></li> - <li><a href="#html-template"><i class="icon-chevron-right"></i> HTML template</a></li> - <li><a href="#examples"><i class="icon-chevron-right"></i> Examples</a></li> - <li><a href="#what-next"><i class="icon-chevron-right"></i> What next?</a></li> - </ul> - </div> - <div class="span9"> - - - - <!-- Download - ================================================== --> - <section id="download-bootstrap"> - <div class="page-header"> - <h1>1. Download</h1> - </div> - <p class="lead">Before downloading, be sure to have a code editor (we recommend <a href="http://sublimetext.com/2">Sublime Text 2</a>) and some working knowledge of HTML and CSS. We won't walk through the source files here, but they are available for download. We'll focus on getting started with the compiled Bootstrap files.</p> - - <div class="row-fluid"> - <div class="span6"> - <h2>Download compiled</h2> - <p><strong>Fastest way to get started:</strong> get the compiled and minified versions of our CSS, JS, and images. No docs or original source files.</p> - <p><a class="btn btn-large btn-primary" href="assets/bootstrap.zip" >Download Bootstrap</a></p> - </div> - <div class="span6"> - <h2>Download source</h2> - <p>Get the original files for all CSS and JavaScript, along with a local copy of the docs by downloading the latest version directly from GitHub.</p> - <p><a class="btn btn-large" href="https://github.com/twitter/bootstrap/zipball/master" >Download Bootstrap source</a></p> - </div> - </div> - </section> - - - - <!-- File structure - ================================================== --> - <section id="file-structure"> - <div class="page-header"> - <h1>2. File structure</h1> - </div> - <p class="lead">Within the download you'll find the following file structure and contents, logically grouping common assets and providing both compiled and minified variations.</p> - <p>Once downloaded, unzip the compressed folder to see the structure of (the compiled) Bootstrap. You'll see something like this:</p> -<pre class="prettyprint"> - bootstrap/ - ├── css/ - │ ├── bootstrap.css - │ ├── bootstrap.min.css - ├── js/ - │ ├── bootstrap.js - │ ├── bootstrap.min.js - └── img/ - ├── glyphicons-halflings.png - └── glyphicons-halflings-white.png -</pre> - <p>This is the most basic form of Bootstrap: compiled files for quick drop-in usage in nearly any web project. We provide compiled CSS and JS (<code>bootstrap.*</code>), as well as compiled and minified CSS and JS (<code>bootstrap.min.*</code>). The image files are compressed using <a href="http://imageoptim.com/">ImageOptim</a>, a Mac app for compressing PNGs.</p> - <p>Please note that all JavaScript plugins require jQuery to be included.</p> - </section> - - - - <!-- Contents - ================================================== --> - <section id="contents"> - <div class="page-header"> - <h1>3. What's included</h1> - </div> - <p class="lead">Bootstrap comes equipped with HTML, CSS, and JS for all sorts of things, but they can be summarized with a handful of categories visible at the top of the <a href="http://getbootstrap.com">Bootstrap documentation</a>.</p> - - <h2>Docs sections</h2> - <h4><a href="http://twitter.github.com/bootstrap/scaffolding.html">Scaffolding</a></h4> - <p>Global styles for the body to reset type and background, link styles, grid system, and two simple layouts.</p> - <h4><a href="http://twitter.github.com/bootstrap/base-css.html">Base CSS</a></h4> - <p>Styles for common HTML elements like typography, code, tables, forms, and buttons. Also includes <a href="http://glyphicons.com">Glyphicons</a>, a great little icon set.</p> - <h4><a href="http://twitter.github.com/bootstrap/components.html">Components</a></h4> - <p>Basic styles for common interface components like tabs and pills, navbar, alerts, page headers, and more.</p> - <h4><a href="http://twitter.github.com/bootstrap/javascript.html">JavaScript plugins</a></h4> - <p>Similar to Components, these JavaScript plugins are interactive components for things like tooltips, popovers, modals, and more.</p> - - <h2>List of components</h2> - <p>Together, the <strong>Components</strong> and <strong>JavaScript plugins</strong> sections provide the following interface elements:</p> - <ul> - <li>Button groups</li> - <li>Button dropdowns</li> - <li>Navigational tabs, pills, and lists</li> - <li>Navbar</li> - <li>Labels</li> - <li>Badges</li> - <li>Page headers and hero unit</li> - <li>Thumbnails</li> - <li>Alerts</li> - <li>Progress bars</li> - <li>Modals</li> - <li>Dropdowns</li> - <li>Tooltips</li> - <li>Popovers</li> - <li>Accordion</li> - <li>Carousel</li> - <li>Typeahead</li> - </ul> - <p>In future guides, we may walk through these components individually in more detail. Until then, look for each of these in the documentation for information on how to utilize and customize them.</p> - </section> - - - - <!-- HTML template - ================================================== --> - <section id="html-template"> - <div class="page-header"> - <h1>4. Basic HTML template</h1> - </div> - <p class="lead">With a brief intro into the contents out of the way, we can focus on putting Bootstrap to use. To do that, we'll utilize a basic HTML template that includes everything we mentioned in the <a href="./getting-started.html#file-structure">File structure</a>.</p> - <p>Now, here's a look at a <strong>typical HTML file</strong>:</p> -<pre class="prettyprint linenums"> -<!DOCTYPE html> -<html> - <head> - <title>Bootstrap 101 Template</title> - </head> - <body> - <h1>Hello, world!</h1> - <script src="http://code.jquery.com/jquery-latest.js"></script> - </body> -</html> -</pre> - <p>To make this <strong>a Bootstrapped template</strong>, just include the appropriate CSS and JS files:</p> -<pre class="prettyprint linenums"> -<!DOCTYPE html> -<html> - <head> - <title>Bootstrap 101 Template</title> - <!-- Bootstrap --> - <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> - </head> - <body> - <h1>Hello, world!</h1> - <script src="http://code.jquery.com/jquery-latest.js"></script> - <script src="js/bootstrap.min.js"></script> - </body> -</html> -</pre> - <p><strong>And you're set!</strong> With those two files added, you can begin to develop any site or application with Bootstrap.</p> - </section> - - - - <!-- Examples - ================================================== --> - <section id="examples"> - <div class="page-header"> - <h1>5. Examples</h1> - </div> - <p class="lead">Move beyond the base template with a few example layouts. We encourage folks to iterate on these examples and not simply use them as an end result.</p> - <ul class="thumbnails bootstrap-examples"> - <li class="span3"> - <a class="thumbnail" href="examples/starter-template.html"> - <img src="assets/img/examples/bootstrap-example-starter.png" alt=""> - </a> - <h4>Starter template</h4> - <p>A barebones HTML document with all the Bootstrap CSS and JavaScript included.</p> - </li> - <li class="span3"> - <a class="thumbnail" href="examples/hero.html"> - <img src="assets/img/examples/bootstrap-example-marketing.png" alt=""> - </a> - <h4>Basic marketing site</h4> - <p>Featuring a hero unit for a primary message and three supporting elements.</p> - </li> - <li class="span3"> - <a class="thumbnail" href="examples/fluid.html"> - <img src="assets/img/examples/bootstrap-example-fluid.png" alt=""> - </a> - <h4>Fluid layout</h4> - <p>Uses our new responsive, fluid grid system to create a seamless liquid layout.</p> - </li> - - <li class="span3"> - <a class="thumbnail" href="examples/marketing-narrow.html"> - <img src="assets/img/examples/bootstrap-example-marketing-narrow.png" alt=""> - </a> - <h4>Narrow marketing</h4> - <p>Slim, lightweight marketing template for small projects or teams.</p> - </li> - <li class="span3"> - <a class="thumbnail" href="examples/justified-nav.html"> - <img src="assets/img/examples/bootstrap-example-justified-nav.png" alt=""> - </a> - <h4>Justified nav</h4> - <p>Marketing page with equal-width navigation links in a modified navbar.</p> - </li> - <li class="span3"> - <a class="thumbnail" href="examples/signin.html"> - <img src="assets/img/examples/bootstrap-example-signin.png" alt=""> - </a> - <h4>Sign in</h4> - <p>Barebones sign in form with custom, larger form controls and a flexible layout.</p> - </li> - - <li class="span3"> - <a class="thumbnail" href="examples/sticky-footer.html"> - <img src="assets/img/examples/bootstrap-example-sticky-footer.png" alt=""> - </a> - <h4>Sticky footer</h4> - <p>Pin a fixed-height footer to the bottom of the user's viewport.</p> - </li> - <li class="span3"> - <a class="thumbnail" href="examples/carousel.html"> - <img src="assets/img/examples/bootstrap-example-carousel.png" alt=""> - </a> - <h4>Carousel jumbotron</h4> - <p>A more interactive riff on the basic marketing site featuring a prominent carousel.</p> - </li> - </ul> - </section> - - - - - <!-- Next - ================================================== --> - <section id="what-next"> - <div class="page-header"> - <h1>What next?</h1> - </div> - <p class="lead">Head to the docs for information, examples, and code snippets, or take the next leap and customize Bootstrap for any upcoming project.</p> - <a class="btn btn-large btn-primary" href="./scaffolding.html" >Visit the Bootstrap docs</a> - <a class="btn btn-large" href="./customize.html" style="margin-left: 5px;" >Customize Bootstrap</a> - </section> + <!-- File structure + ================================================== --> + <div class="bs-docs-section" id="whats-included"> + <div class="page-header"> + <h1>What's included</h1> + </div> + <p class="lead">Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations.</p> + <p>Once downloaded, unzip the compressed folder to see the structure of (the compiled) Bootstrap. You'll see something like this:</p> + +{% highlight bash %} +bootstrap/ +├── css/ +│ ├── bootstrap.css +│ ├── bootstrap.min.css +├── js/ +│ ├── bootstrap.js +│ ├── bootstrap.min.js +└── fonts/ + ├── glyphiconshalflings-regular.eot + ├── glyphiconshalflings-regular.otf + ├── glyphiconshalflings-regular.svg + ├── glyphiconshalflings-regular.ttf + └── glyphiconshalflings-regular.woff +{% endhighlight %} + + <p>This is the most basic form of Bootstrap: compiled files for quick drop-in usage in nearly any web project. We provide compiled CSS and JS (<code>bootstrap.*</code>), as well as compiled and minified CSS and JS (<code>bootstrap.min.*</code>). The image files are compressed using <a href="http://imageoptim.com/">ImageOptim</a>, a Mac app for compressing PNGs.</p> + <div class="bs-callout"> + <h4>jQuery required</h4> + <p>Please note that <strong>all JavaScript plugins require jQuery</strong> to be included, as shown in the <a href="#examples">starter template</a>.</p> + </div> + </div> + <!-- Examples + ================================================== --> + <div class="bs-docs-section" id="examples"> + <div class="page-header"> + <h1>Templates and examples</h1> + </div> + <p class="lead">Make use of a super basic HTML template, or dive into a few examples we've started for you. We encourage folks to iterate on these examples and not simply use them as an end result.</p> + <h3 id="examples-template">HTML template</h3> + <p>Copy and paste the HTML from below to get started with a bare bones Bootstrap document.</p> +{% highlight html %} +<!DOCTYPE html> +<html> + <head> + <title>Bootstrap 101 Template</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <!-- Bootstrap --> + <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> + </head> + <body> + <h1>Hello, world!</h1> + <!-- JavaScript plugins (requires jQuery) --> + <script src="http://code.jquery.com/jquery.js"></script> + <!-- Include all compiled plugins (below), or include individual files as needed --> + <script src="js/bootstrap.min.js"></script> + + <!-- Optionally enable responsive features in IE8 --> + <script src="js/respond.js"></script> + </body> +</html> +{% endhighlight %} + + <h3 id="examples-list">Examples</h3> + <div class="bs-examples"> + <div class="row"> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/starter-template/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-starter.png" alt=""> + </a> + <h4>Starter template</h4> + <p>A barebones HTML page with Bootstrap's CSS and JavaScript included.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/grid/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-grid.png" alt=""> + </a> + <h4>Basic grid layouts</h4> + <p>Simple grid layouts to familiarize you with using the Bootstrap grid system.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/jumbotron/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-marketing.png" alt=""> + </a> + <h4>Basic marketing site</h4> + <p>Features a jumbotron for primary message and three supporting elements.</p> + </div> + </div> + <div class="row"> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/jumbotron-narrow/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-jumbotron-narrow.png" alt=""> + </a> + <h4>Narrow marketing</h4> + <p>Slim, lightweight marketing template for small projects or teams.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/justified-nav/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-justified-nav.png" alt=""> + </a> + <h4>Justified nav</h4> + <p>Marketing page with equal-width navigation links in a modified navbar.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/signin/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-signin.png" alt=""> + </a> + <h4>Sign in</h4> + <p>Barebones sign in form with custom, larger form controls and a flexible layout.</p> + </div> + </div> + <div class="row"> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/sticky-footer/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-sticky-footer.png" alt=""> + </a> + <h4>Sticky footer</h4> + <p>Pin a fixed-height footer to the bottom of the user's viewport.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/sticky-footer-navbar/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-sticky-footer-navbar.png" alt=""> + </a> + <h4>Sticky footer w/ navbar</h4> + <p>Add a fixed navbar to the default sticky footer template.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/carousel/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-carousel.png" alt=""> + </a> + <h4>Carousel jumbotron</h4> + <p>An interactive riff on the basic marketing site featuring a prominent carousel.</p> + </div> + </div> + <div class="row"> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/navbar/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-navbar.png" alt=""> + </a> + <h4>Navbar</h4> + <p>Basic template for showcasing how the navbar works.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/navbar-static-top/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-navbar-static-top.png" alt=""> + </a> + <h4>Static top navbar</h4> + <p>Basic template for showcasing the static navbar variation.</p> + </div> + <div class="col-lg-4"> + <a class="thumbnail" href="/examples/navbar-fixed-top/" target="_blank"> + <img src="/assets/img/examples/bootstrap-example-navbar-fixed-top.png" alt=""> + </a> + <h4>Fixed top navbar</h4> + <p>Basic template for showcasing the fixed navbar variation.</p> + </div> </div> </div> - </div> - <!-- Footer - ================================================== --> - <footer class="footer"> - <div class="container"> - <p>Designed and built with all the love in the world by <a href="http://twitter.com/mdo" target="_blank">@mdo</a> and <a href="http://twitter.com/fat" target="_blank">@fat</a>.</p> - <p>Code licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>, documentation under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p> - <p><a href="http://glyphicons.com">Glyphicons Free</a> licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p> - <ul class="footer-links"> - <li><a href="http://blog.getbootstrap.com">Blog</a></li> - <li class="muted">·</li> - <li><a href="https://github.com/twitter/bootstrap/issues?state=open">Issues</a></li> - <li class="muted">·</li> - <li><a href="https://github.com/twitter/bootstrap/wiki">Roadmap and changelog</a></li> - </ul> - </div> - </footer> - - - <!-- Le javascript - ================================================== --> - <!-- Placed at the end of the document so the pages load faster --> - <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> - <script src="assets/js/jquery.js"></script> - <script src="assets/js/bootstrap-transition.js"></script> - <script src="assets/js/bootstrap-alert.js"></script> - <script src="assets/js/bootstrap-modal.js"></script> - <script src="assets/js/bootstrap-dropdown.js"></script> - <script src="assets/js/bootstrap-scrollspy.js"></script> - <script src="assets/js/bootstrap-tab.js"></script> - <script src="assets/js/bootstrap-tooltip.js"></script> - <script src="assets/js/bootstrap-popover.js"></script> - <script src="assets/js/bootstrap-button.js"></script> - <script src="assets/js/bootstrap-collapse.js"></script> - <script src="assets/js/bootstrap-carousel.js"></script> - <script src="assets/js/bootstrap-typeahead.js"></script> - <script src="assets/js/bootstrap-affix.js"></script> + <div class="bs-docs-section" id="customizing"> + <div class="page-header"> + <h1>Customizing Bootstrap</h1> + </div> + <p class="lead">Customizing Bootstrap is best accomplished when you treat it as another dependency in your development stack. Doing so ensures future upgrades are as easy as possible while also familiarizing yourself to the intricacies of the framework.</p> - <script src="assets/js/holder/holder.js"></script> - <script src="assets/js/google-code-prettify/prettify.js"></script> + <p>Once you've downloaded and included Bootstrap's CSS into your templates, you can move on to customizing the included components. To do so, create a new stylesheet (LESS, if you like, or just plain CSS) to house your customizations.</p> - <script src="assets/js/application.js"></script> + <div class="bs-callout"> + <h4>Compiled or minified?</h4> + <p>Unless you plan on reading a good chunk of the compiled CSS, go with the minified. It's the same code, just compacted. Less bandwidth is good, especially in production environments.</p> + </div> + <p>From there, include whatever Bootstrap components and HTML content you need to get your template setup. It's best to have a rough idea in mind of modifications to make and content to include, so be sure to spend a brief amount of time on that before moving on.</p> + + <h3>Customizing components</h3> + <p>There are varying degrees to customizing components, but most fall into two camps: light customizations and complete visual overhauls. Luckily, there are plenty of examples of both.</p> + <p>We define light customizations as mostly surface layer changes, things like a color and font changes to existing Bootstrap components. A great example of this is the the <a href="http://translate.twitter.com">Twitter Translation Center</a> (coded by @mdo). Let's look at how to implement the custom button we wrote for this site, <code>.btn-ttc</code>.</p> + <p>Instead of using the provided Bootstrap buttons, which only require just one class to start, <code>.btn</code>, we'll add our own modifier class, <code>.btn-ttc</code>. This will give us a slightly custom look with minimal effort.</p> +{% highlight html %} +<button type="button" class="btn btn-ttc">Save changes</button> +{% endhighlight %} + + <p>In the custom stylesheet, add the following CSS:</p> + +{% highlight css %} +/* Custom button +-------------------------------------------------- */ + +/* Override base .btn styles */ +/* Apply text and background changes to three key states: default, hover, and active (click). */ +.btn-ttc, +.btn-ttc:hover, +.btn-ttc:active { + color: white; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); + background-color: #007da7; +} + +/* Apply the custom-colored gradients */ +/* Note: you'll need to include all the appropriate gradients for various browsers and standards. */ +.btn-ttc { + background-repeat: repeat-x; + background-image: linear-gradient(top, #009ED2 0%, #007DA7 100%); + ... +} + +/* Set the hover state */ +/* An easy hover state is just to move the gradient up a small amount. Add other embellishments as you see fit. */ +.btn-ttc:hover { + background-position: 0 -15px; +} +{% endhighlight %} + + <p>Customizing Bootstrap components takes time, but should be straightforward. <strong>Look to the source code often and duplicate the selectors you need for your modifications.</strong> Placing them after the Bootstrap source makes for easy overriding without complication. <strong>To recap, here's the basic workflow:</strong></p> + <ul> + <li>For each element you want to customize, find its code in the compiled Bootstrap CSS. Copy and paste the selector for a component as-is. For instance, to customize the navbar background, just snag <code>.navbar</code>.</li> + <li>Add all your custom CSS in a separate stylesheet using the selectors you just copied from the Bootstrap source. No need for prefacing with additional classes or using <code>!important</code> here.</li> + <li>Rinse and repeat until you're happy with your customizations.</li> + </ul> + <p>Going beyond light customizations and into visual overhauls is just as straightforward as the above custom button. For a site like <a href="http://yourkarma.com">Karma</a>, which uses Bootstrap as a CSS reset with heavy modifications, more extensive work is involved, but well worth it in the end.</p> + + <div class="bs-callout"> + <h4>Alternate customization methods</h4> + <p>While not recommended for folks new to Bootstrap, you may use one of two alternate methods for customization. The first is modifying the source .less files (making upgrades super difficult), and the second is mapping source LESS code to <a href="http://ruby.bvision.com/blog/please-stop-embedding-bootstrap-classes-in-your-html">your own classes via mixins</a>. For the time being, neither options are documented here.</p> + </div> + <h3>Removing potential bloat</h3> + <p>Not all sites and applications need to make use of everything Bootstrap has to offer, especially in production environments where bandwidth literally becomes a financial issue. We encourage folks to remove whatever is unused with our <a href="/customize/">Customizer</a>.</p> + <p>Using the Customizer, simply uncheck any component, feature, or asset you don't need. Hit download and swap out the default Bootstrap files with these newly customized ones. You'll get vanilla Bootstrap, but without the features *you* deem unnecessary. All custom builds include compiled and minified versions, so use whichever works for you.</p> - </body> -</html> + </div> |
