unignore bower_components
[bootswatch] / bower_components / bootstrap / getting-started.html
1 ---
2 layout: default
3 title: Getting started
4 slug: getting-started
5 lead: "An overview of Bootstrap, how to download and use, basic templates and examples, and more."
6 base_url: "../"
7 ---
8
9
10   <!-- Getting started
11   ================================================== -->
12   <div class="bs-docs-section">
13     <div class="page-header">
14       <h1 id="download">Download Bootstrap</h1>
15     </div>
16     <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>
17
18     <h3>Download compiled CSS and JS</h3>
19     <p class="lead">The fastest way to get started is to get the compiled and minified versions of our CSS and JavaScript. No documentation or original source files are included.</p>
20     <p><a class="btn btn-large btn-primary" href="{{ site.download_dist }}" onclick="_gaq.push(['_trackEvent', 'Getting started', 'Download', 'Download compiled']);">Download Bootstrap</a></p>
21
22     <hr>
23
24     <h3 id="download-options">More download options</h3>
25     <div class="bs-docs-dl-options">
26       <h4>
27         <a href="{{ site.download }}" onclick="_gaq.push(['_trackEvent', 'Getting started', 'Download', 'Download source']);">Download latest source code</a>
28       </h4>
29       <p>Get the original files for all CSS and JavaScript by downloading the latest version directly from GitHub.</p>
30       <h4>
31         <a href="{{ site.repo }}" onclick="_gaq.push(['_trackEvent', 'Getting started', 'Download', 'GitHub project']);">Clone or fork via GitHub</a>
32       </h4>
33       <p>Clone the entire project or fork your own version of Bootstrap to make it your own by visiting us on GitHub.</p>
34       <h4>
35         Install with <a href="http://bower.io">Bower</a>
36       </h4>
37       <p>Install and manage the original files for all CSS and JavaScript, along with a local copy of the docs, using <a href="http://bower.io">Bower</a>.</p>
38       {% highlight bash %}$ bower install bootstrap{% endhighlight %}
39     </div>
40
41     <hr>
42
43     <h3 id="download-cdn">Use the Bootstrap CDN</h3>
44     <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>
45 {% highlight html linenos %}
46 <!-- Latest compiled and minified CSS -->
47 <link href="{{ site.cdn_css }}">
48
49 <!-- Latest compiled and minified JavaScript -->
50 <script src="{{ site.cdn_js }}"></script>
51 {% endhighlight %}
52
53     <div class="bs-callout bs-callout-warning" id="callout-less-compilation">
54       <h4>LESS compilation</h4>
55       <p>If you download the original files, you need to compile Bootstrap's LESS files into usable CSS. To do that, Bootstrap only officially supports <a href="http://twitter.github.io/recess/">Recess</a>, Twitter's CSS hinter built on top of <a href="http://lesscss.org">less.js</a>.</p>
56     </div>
57   </div>
58
59
60
61   <!-- File structure
62   ================================================== -->
63   <div class="bs-docs-section">
64     <div class="page-header">
65       <h1 id="whats-included">What's included</h1>
66     </div>
67     <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>
68     <p>Once downloaded, unzip the compressed folder to see the structure of (the compiled) Bootstrap. You'll see something like this:</p>
69
70 {% highlight bash %}
71 bootstrap/
72 ├── css/
73 │   ├── bootstrap.css
74 │   ├── bootstrap.min.css
75 ├── js/
76 │   ├── bootstrap.js
77 │   ├── bootstrap.min.js
78 {% endhighlight %}
79
80     <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>
81     <div class="bs-callout bs-callout-danger">
82       <h4>jQuery required</h4>
83       <p>Please note that <strong>all JavaScript plugins require jQuery</strong> to be included, as shown in the <a href="#template">starter template</a>.</p>
84     </div>
85   </div>
86
87
88
89   <!-- Template
90   ================================================== -->
91   <div class="bs-docs-section">
92     <div class="page-header">
93       <h1 id="template">Basic template</h1>
94     </div>
95     <p class="lead">Make use of a super basic HTML template, or dive into a <a href="{{ site.examples }}">few examples</a> we've started for you. We encourage folks to iterate on these examples and not simply use them as an end result.</p>
96
97     <p>Copy and paste the HTML from below to get started with a bare bones Bootstrap document.</p>
98 {% highlight html %}
99 <!DOCTYPE html>
100 <html>
101   <head>
102     <title>Bootstrap 101 Template</title>
103     <meta name="viewport" content="width=device-width, initial-scale=1.0">
104     <!-- Bootstrap -->
105     <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
106   </head>
107   <body>
108     <h1>Hello, world!</h1>
109
110     <!-- JavaScript plugins (requires jQuery) -->
111     <script src="http://code.jquery.com/jquery.js"></script>
112     <!-- Include all compiled plugins (below), or include individual files as needed -->
113     <script src="js/bootstrap.min.js"></script>
114
115     <!-- Optionally enable responsive features in IE8 -->
116     <script src="js/respond.js"></script>
117   </body>
118 </html>
119 {% endhighlight %}
120
121     <h3>Looking for more example templates?</h3>
122     <p>Check out the new <a href="{{ site.examples_repo }}">Examples repository on GitHub</a>, or <a href="{{ site.examples }}">view them in your browser</a>. Included are over a dozen example templates for building with and extending Bootstrap.</p>
123   </div>
124
125
126
127   <!-- Browser compatibility
128   ================================================== -->
129   <div class="bs-docs-section">
130     <div class="page-header">
131       <h1 id="browsers">Browser compatibility</h1>
132     </div>
133     <p class="lead">Bootstrap is built to work best in the latest desktop and mobile browsers, meaning older and less advanced browsers might receive a less stylized, though fully functional, version of certain components.</p>
134
135     <h3>Supported browsers</h3>
136     <p>Specifically, we support the latest versions of the following:</p>
137     <ul>
138       <li>Chrome (Mac, Windows, iOS, and Android)</li>
139       <li>Safari (Mac and iOS only, as Windows has more or less been discontinued)</li>
140       <li>Firefox (Mac, Windows)</li>
141       <li>Internet Explorer</li>
142       <li>Opera (Mac, Windows)</li>
143     </ul>
144     <p>Unofficially, Bootstrap should look and behave well enough in Chromium for Linux and Internet Explorer 7, though they are not officially supported.</p>
145
146     <h3>Internet Explorer 8 and 9</h3>
147     <p>Internet Explorer 8 and 9 are also supported, however, please be aware that many CSS3 properties—e.g., rounded corners and shadows—are not supported by IE8. The <code>placeholder</code> attribute is also not supported in either of these versions.</p>
148     <p>In addition, <strong>Internet Explorer 8 requires the use of <a href="https://github.com/scottjehl/Respond">respond.js</a> to enable media query support.</strong></p>
149
150     <h3>IE Compatibility modes</h3>
151     <p>Bootstrap is not supported in the old Internet Explorer compatibility modes. To be sure you're using the latest rendering mode for IE, consider including the appropriate <code>meta</code> tag in your pages.</p>
152 {% highlight html %}
153 <meta http-equiv="X-UA-Compatible" content="IE=edge">
154 {% endhighlight %}
155     <p>See <a href="http://stackoverflow.com/questions/6771258/whats-the-difference-if-meta-http-equiv-x-ua-compatible-content-ie-edge">this StackOverflow question</a> for more information.</p>
156   </div>
157
158
159
160   <!-- License FAQs
161   ================================================== -->
162   <div class="bs-docs-section">
163     <div class="page-header">
164       <h1 id="license-faqs">License FAQs</h1>
165     </div>
166     <p class="lead">Bootstrap is released under the Apache 2 license and is copyright {{ site.time | date: "%Y" }} Twitter. Boiled down to smaller chunks, it can be described with the following conditions.</p>
167
168     <div class="row">
169       <div class="col-12 col-lg-6">
170         <h4>It allows you to:</h4>
171         <ul>
172           <li>Freely download and use Bootstrap, in whole or in part, for personal, company internal or commercial purposes</li>
173           <li>Use Bootstrap in packages or distributions that you create</li>
174         </ul>
175       </div>
176       <div class="col-12 col-lg-6">
177         <h4>It forbids you to:</h4>
178         <ul>
179           <li>Redistribute any piece of Bootstrap without proper attribution</li>
180           <li>Use any marks owned by Twitter in any way that might state or imply that Twitter endorses your distribution</li>
181           <li>Use any marks owned by Twitter in any way that might state or imply that you created the Twitter software in question</li>
182         </ul>
183       </div>
184     </div>
185     <div class="row">
186       <div class="col-12 col-lg-6">
187         <h4>It requires you to:</h4>
188         <ul>
189           <li>Include a copy of the license in any redistribution you may make that includes Bootstrap</li>
190           <li>Provide clear attribution to Twitter for any distributions that include Bootstrap</li>
191         </ul>
192       </div>
193       <div class="col-12 col-lg-6">
194         <h4>It does not require you to:</h4>
195         <ul>
196           <li>Include the source of Bootstrap itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it</li>
197           <li>Submit changes that you make to Bootstrap back to Twitter (though such feedback is encouraged)</li>
198         </ul>
199       </div>
200     </div>
201     <p>The full Bootstrap license is located <a href="{{ site.repo }}/blob/master/README.md">in the project repository</a> for more information.</p>
202   </div><!-- /.bs-docs-section -->
203
204
205
206
207   <div class="bs-docs-section">
208     <div class="page-header">
209       <h1 id="customizing">Customizing Bootstrap</h1>
210     </div>
211     <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>
212
213     <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>
214
215     <div class="bs-callout bs-callout-info">
216       <h4>Compiled or minified?</h4>
217       <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>
218     </div>
219
220     <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>
221
222     <h3>Customizing components</h3>
223     <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>
224     <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>
225     <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>
226 {% highlight html %}
227 <button type="button" class="btn btn-ttc">Save changes</button>
228 {% endhighlight %}
229
230   <p>In the custom stylesheet, add the following CSS:</p>
231
232 {% highlight css %}
233 /* Custom button
234 -------------------------------------------------- */
235
236 /* Override base .btn styles */
237 /* Apply text and background changes to three key states: default, hover, and active (click). */
238 .btn-ttc,
239 .btn-ttc:hover,
240 .btn-ttc:active {
241   color: white;
242   text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
243   background-color: #007da7;
244 }
245
246 /* Apply the custom-colored gradients */
247 /* Note: you'll need to include all the appropriate gradients for various browsers and standards. */
248 .btn-ttc {
249   background-repeat: repeat-x;
250   background-image: linear-gradient(top, #009ED2 0%, #007DA7 100%);
251   ...
252 }
253
254 /* Set the hover state */
255 /* An easy hover state is just to move the gradient up a small amount. Add other embellishments as you see fit. */
256 .btn-ttc:hover {
257   background-position: 0 -15px;
258 }
259 {% endhighlight %}
260
261     <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>
262     <ul>
263       <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>
264       <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>
265       <li>Rinse and repeat until you're happy with your customizations.</li>
266     </ul>
267     <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>
268
269     <div class="bs-callout bs-callout-info">
270       <h4>Alternate customization methods</h4>
271       <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>
272     </div>
273
274     <h3>Removing potential bloat</h3>
275     <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>
276     <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>
277
278   </div>