Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Bootstrap hè un toolkit da Twitter pensatu per kickstart u sviluppu di webapps è siti.
Include CSS basi è HTML per a tipografia, forme, buttoni, tavule, griglie, navigazione è più.
Nerd alert: Bootstrap hè custruitu cù Less è hè statu cuncepitu per travaglià fora di a porta cù solu navigatori muderni in mente.
Per u principiu più rapidu è faciule, basta copiate stu snippet in a vostra pagina web.
Un fan di utilizà Less? Nisun prublema, basta clone u repo è aghjunghje queste linee:
Scaricate, forchetta, tirate, prublemi di schedari, è più cù u repo ufficiale di Bootstrap in Github.
U sistema di griglia predeterminatu furnitu cum'è parte di Bootstrap hè una griglia larga 940px di 16 colonne. Hè un sapori di u famosu sistema di griglia 960, ma senza u margine / padding supplementu nantu à i lati manca è destra.
Cum'è mostratu quì, un layout di basa pò esse creatu cù duie "columne", ognuna spanning un numeru di e 16 culonni fundamentali chì avemu definitu cum'è parte di u nostru sistema di griglia. Vede l'esempii sottu per più variazioni.
- <div class="row"> class = "fila" >
- <div class = "span6 columns" >
- ...
- </div>
- <div class = "span10 columns" >
- ...
- </div>
- </div>
Un cuntainer di basa di 940px largu, centratu per quasi ogni situ o pagina.
- <corpu>
- <div class = "container" >
- ...
- </div>
- </corpu>
Una struttura di pagina fluida o liquida flessibile cù larghezza minima è massima è una barra laterale di sinistra. Grande per l'applicazioni.
- <corpu>
- <div class = "container-fluid" >
- <div class = "sidebar" >
- ...
- </div>
- <div class = "cuntenutu" >
- ...
- </div>
- </div>
- </corpu>
Una gerarchia tipografica standard per a strutturazione di e vostre pagine web.
Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula ut id elit.
Pudete ancu aghjunghje sottutituli cù <strong>
e<em>
Utilizendu enfasi, indirizzi è abbreviazioni
<strong>
<em>
<address>
<abbr>
I tag di enfasi ( <strong>
è <em>
) deve esse usatu per aghjunghje una distinzione visuale trà una parolla o frase è a so copia circundante. Aduprate <strong>
per l'attenzione vechja è <em>
per l' attenzione è i tituli.
Fusce dapibus , tellus ac cursus commodo , tortor mauris condimentum nibh , ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, a pharetra augue.
L' address
elementu hè utilizatu per - l'avete invintatu ! - indirizzi. Eccu cumu si vede:
Nota: Ogni linea in un address
deve finisce cù una linea-break ( <br />
) per strutturà currettamente u cuntenutu cum'è lettu in a vita reale senza alcunu stili applicati.
Per l'abbreviazioni è l'acronimi, utilizate l' abbr
etichetta ( acronym
hè deprecated in HTML5 ). Mettite a forma di shorthand in u tag è stabilisce un titulu per u nome cumpletu.
<blockquote>
<p>
<cite>
Assicuratevi di imballà u vostru blockquote
attornu paragraph
è cite
tag. Quandu citate una fonte, utilizate l' cite
elementu. U CSS prefarà automaticamente un nome cù un dash em (—).
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...
Dr Julius Hibbert
<ul>
<ul.unstyled>
<ol>
dl
<table>
<thead>
<tbody>
<tr>
<th>
<td>
<colspan>
<caption>
I tavulini sò grandi - per parechje cose. Grandi tavule, però, anu bisognu di un pocu di markup love per esse utili, scalabili è leghjite (à u livellu di codice). Eccu uni pochi di cunsiglii per aiutà.
Imbulighjate sempre i vostri intestazioni di colonna in un thead
tali chì a ghjerarchia hè thead
> tr
> th
.
Simile à l'intestazione di a colonna, tuttu u cuntenutu di u corpu di a vostra tavula deve esse impannillatu in una tbody
manera chì a vostra ghjerarchia hè tbody
> tr
> td
.
Tutte e tavule seranu automaticamente stilate cù solu i cunfini essenziali per assicurà a leggibilità è mantene a struttura. Ùn ci hè bisognu di aghjunghje classi o attributi extra.
# | Nomu | Casata | Lingua |
---|---|---|---|
1 | Certi | Unu | Inglese |
2 | Joe | Sixpack | Inglese |
3 | Stu | Dent | Codice |
- <table class="table-cumune"> class = "tavola cumuna" >
- ...
- </table>
Fate un pocu di fantasia cù i vostri tavulini aghjunghjendu zebra-striping - basta aghjunghje a .zebra-striped
classa.
# | Nomu | Casata | Lingua |
---|---|---|---|
1 | Certi | Unu | Inglese |
2 | Joe | Sixpack | Inglese |
3 | Stu | Dent | Codice |
- <table class="common-table zebra-striped"> class = "tavola cumuna zebra-striped" >
- ...
- </table>
Pigliendu l'esempiu precedente, migliurà l'utilità di e nostre tavule furnite una funziunalità di sorte via jQuery è u plugin Tablesorter . Cliccate nantu à l'intestazione di qualsiasi colonna per cambià a sorta.
# | Nomu | Casata | Lingua |
---|---|---|---|
1 | U vostru | Unu | Inglese |
2 | Joe | Sixpack | Inglese |
3 | Stu | Dent | Codice |
- <script type="text/javascript" src="js/jquery/jquery.tablesorter.min.js"></script> type = "text/javascript" src = "js/jquery/jquery.tablesorter.min.js" ></script>
- <script type = "text/javascript" >
- $ ( documentu ). pronta ( funzione () {
- $ ( "table#sortTableExample" ). tablesorter ( { sortList : [[ 1 , 0 ]]} );
- });
- </script>
- <table class = "tavula cumuna zebra-striped" >
- ...
- </table>
Tutte e forme sò datu stili predeterminati per presentà in una manera leggibile è scalabile. Stili sò furniti per inputs di testu, selezziunà listi, aree di testu, buttoni di radiu è caselle di verificazione, è buttoni.
Aghjunghjite .form-stacked
à l'HTML di u vostru furmulariu è avete etichette nantu à i so campi invece di a so manca. Questu funziona bè se i vostri formi sò brevi o avete duie colonne di input per forme più pesanti.
Comu cunvenzione, i buttoni sò usati per l'azzioni mentre i ligami sò usati per l'uggetti. Per esempiu, "Download" puderia esse un buttone è "attività recente" puderia esse un ligame.
Tutti i buttoni predeterminate à un stile grisgiu chjaru, ma una .primary
classa blu hè dispunibule. In più, rotulà i vostri stili hè faciule faciule.
Stili di buttone pò esse appiicati à qualsiasi cosa cù l' .btn
applicata. Di genere, vulete applicà questi solu à elementi a
, button
, è selezziunate . input
Eccu cumu si vede:
Vulete i buttoni più grande o più chjucu? Amparate!
Per i buttoni chì ùn sò micca attivi o chì sò disattivati da l'app per una ragione o un altru, utilizate u statu disattivatu. Hè .disabled
per ligami è :disabled
per button
elementi.
One-line messages for highlighting the failure, possible failure, or success of an action. Particularly useful for forms.
For messages that require a bit of explanation, we have paragraph style alerts. These are perfect for bubbling up longer error messages, warning a user of a pending action, or just presenting information for more emphasis on the page.
Modals—dialogs or lightboxes—are great for contextual actions in situations where it's important that the background context be maintained.
One fine body...
Twipsies are super useful for aiding a confused user and pointing them in the right direction.
Lorem ipsum dolar sit amet illo error ipsum veritatis aut iste perspiciatis iste voluptas natus illo quasi odit aut natus consequuntur consequuntur, aut natus illo voluptatem odit perspiciatis laudantium rem doloremque totam voluptas. Voluptasdicta eaque beatae aperiam ut enim voluptatem explicabo explicabo, voluptas quia odit fugit accusantium totam totam architecto explicabo sit quasi fugit fugit, totam doloremque unde sunt sed dicta quae accusantium fugit voluptas nemo voluptas voluptatem rem quae aut veritatis quasi quae.
Use popovers to provide subtextual information to a page without effecting layout.
Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Bootstrap was built with Preboot, an open-source pack of mixins and variables to be used in conjunction with Less, a CSS preprocessor for faster and easier web development.
Check out how we used Preboot in Bootstrap and how you can make use of it should you choose to run Less on your next project.
Use this option to make full use of Bootstrap's Less variables, mixins, and nesting in CSS via javascript in your browser.
- <link rel="stylesheet/less" type="text/css" href="less/bootstrap.less" media="all" />
- <script type="text/javascript" src="js/less-1.0.41.min.js"></script>
Not feeling the .js solution? Try the Less Mac app or use Node.js to compile when you deploy your code.
Here are some of the highlights of what's included in Twitter Bootstrap as part of Bootstrap. Head over to the Bootstrap website or Github project page to download and learn more.
Variables in Less are perfect for maintaining and updating your CSS headache free. When you want to change a color value or a frequently used value, update it in one spot and you're set.
- // Links
- @linkColor: #8b59c2;
- @linkColorHover: darken(@linkColor, 10);
- // Grays
- @black: #000;
- @grayDark: lighten(@black, 25%);
- @gray: lighten(@black, 50%);
- @grayLight: lighten(@black, 70%);
- @grayLighter: lighten(@black, 90%);
- @white: #fff;
- // Accent Colors
- @blue: #08b5fb;
- @green: #46a546;
- @red: #9d261d;
- @yellow: #ffc40d;
- @orange: #f89406;
- @pink: #c3325f;
- @purple: #7a43b6;
- // Baseline
- @baseline: 20px;
Less also provides another style of commenting in addition to CSS's normal /* ... */
syntax.
- // This is a comment
- /* This is also a comment */
Mixins are basically includes or partials for CSS, allowing you to combine a block of code into one. They're great for vendor prefixed properties like box-shadow
, cross-browser gradients, font stacks, and more. Below is a sample of the mixins that are included with Bootstrap.
- #font {
- .shorthand(@weight: normal, @size: 14px, @lineHeight: 20px) {
- font-size: @size;
- font-weight: @weight;
- line-height: @lineHeight;
- }
- .sans-serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
- font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: @size;
- font-weight: @weight;
- line-height: @lineHeight;
- }
- .serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
- font-family: "Georgia", Times New Roman, Times, sans-serif;
- font-size: @size;
- font-weight: @weight;
- line-height: @lineHeight;
- }
- .monospace(@weight: normal, @size: 12px, @lineHeight: 20px) {
- font-family: "Monaco", Courier New, monospace;
- font-size: @size;
- font-weight: @weight;
- line-height: @lineHeight;
- }
- }
- #gradient {
- .horizontal (@startColor: #555, @endColor: #333) {
- background-color: @endColor;
- background-repeat: repeat-x;
- background-image: -khtml-gradient(linear, left top, right top, from(@startColor), to(@endColor)); // Konqueror
- background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
- background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10
- background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
- background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
- background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
- -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor); // IE8+
- filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE6 & IE7
- background-image: linear-gradient(left, @startColor, @endColor); // Le standard
- }
- .vertical (@startColor: #555, @endColor: #333) {
- background-color: @endColor;
- background-repeat: repeat-x;
- background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); // Konqueror
- background-image: -moz-linear-gradient(@startColor, @endColor); // FF 3.6+
- background-image: -ms-linear-gradient(@startColor, @endColor); // IE10
- background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
- background-image: -webkit-linear-gradient(@startColor, @endColor); // Safari 5.1+, Chrome 10+
- background-image: -o-linear-gradient(@startColor, @endColor); // Opera 11.10
- -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor); // IE8+
- filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE6 & IE7
- background-image: linear-gradient(@startColor, @endColor); // The standard
- }
- .directional (@startColor: #555, @endColor: #333, @deg: 45deg) {
- ...
- }
- .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 0.5, @endColor: #c3325f) {
- ...
- }
- }
Get fancy and perform some math to generate flexible and powerful mixins like the one below.
- // Griditude
- @gridColumns: 16;
- @gridColumnWidth: 40px;
- @gridGutterWidth: 20px;
- // Grid System
- .container {
- width: @siteWidth;
- margin: 0 auto;
- .clearfix();
- }
- .columns(@columnSpan: 1) {
- display: inline;
- float: left;
- width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
- margin-left: @gridGutterWidth;
- &:first-child {
- margin-left: 0;
- }
- }
- .offset(@columnOffset: 1) {
- margin-left: (@gridColumnWidth * @columnOffset) + (@gridGutterWidth * (@columnOffset - 1)) !important;
- }