Bootstrap, ho tsoa ho Twitter

Bootstrap ke sesebelisoa se tsoang ho Twitter se etselitsoeng ho qala nts'etsopele ea lisebelisoa tsa marang-rang le libaka.
E kenyelletsa CSS ea mantlha le HTML bakeng sa typography, liforomo, likonopo, litafole, li-grids, navigation, le tse ling.

Tlhokomeliso ea Nerd: Bootstrap e hahiloe ka Less mme e etselitsoe ho sebetsa kantle ho heke ho nahanoa ka libatli tsa sejoale-joale.

Ho hokahanya le CSS

Bakeng sa ho qala ka potlako le ka mokhoa o bonolo, kopitsa feela poleloana ena leqepheng la hau la tepo.

E sebedise ka Tlase

Motho ea ratang ho sebelisa tse Nyane? Ha ho na bothata, kopanya feela repo mme u kenye mela ena:

Fork ho GitHub

Khoasolla, fereko, hula, litaba tsa faele, le tse ling ka repo ea semmuso ea Bootstrap ho Github.

Bootstrap ho GitHub »

Histori

Matsatsing a pejana a Twitter, baenjiniere ba ne ba sebelisa laebrari efe kapa efe eo ba e tloaetseng ho fihlela litlhoko tsa pele. Bootstrap e qalile e le karabo ea liqholotso tse hlahisitsoeng le nts'etsopele e potlakileng nakong ea Hackweek ea pele ea Twitter.

Ka thuso le maikutlo a baenjiniere ba bangata ba Twitter, Bootstrap e holile haholo ho kenyelletsa eseng feela mekhoa ea mantlha, empa le mekhoa e metle le e tšoarellang ea meralo e ka pele.

Bala haholoanyane ho dev.twitter.com ›

Tšehetso ea sebatli

Bootstrap e lekoa le ho tšehetsoa ho libatli tse kholo tsa sejoale-joale joalo ka Chrome, Safari, Internet Explorer le Firefox.

E lekoa le ho tšehetsoa ho Chrome, Safari, Internet Explorer, le Firefox
  • Safari ea morao-rao
  • Google Chrome ea morao-rao
  • Firefox 4+
  • Internet Explorer 7+

Se kenyellelitsoeng

Bootstrap e tla e phethehile ka CSS e hlophisitsoeng, e sa kopanngoang, le litempele tsa mohlala.

  • Lifaele tsohle tsa mantlha tsa .less
  • CSS e hlophisitsoeng ka botlalo le e ntlafalitsoeng
  • Litokomane tse felletseng tsa styleguide
  • Mohlala oa leqephe la template (tse ling li tla tla haufinyane)

Gridi ea kamehla

Sistimi ea grid ea kamehla e fanoeng e le karolo ea Bootstrap ke marang-rang a 940px a bophara ba likholomo tse 16. Ke tatso ea sistimi e tsebahalang ea grid ea 960, empa ntle le marang-rang / padding ka lehlakoreng le letšehali le le letona.

Mohlala oa marang-rang

Joalokaha ho bontšitsoe mona, moralo oa motheo o ka etsoa ka "likholomo" tse peli, e 'ngoe le e' ngoe e nka palo ea litšiea tse 16 tseo re li hlalositseng e le karolo ea tsamaiso ea rona ea marang-rang. Sheba mehlala e ka tlase bakeng sa mefuta e meng e fapaneng.

  1. <div class="row"> sehlopha = "mola" >
  2. <div class = "span6 columns" >
  3. ...
  4. </ div>
  5. <div class = "span10 columns" >
  6. ...
  7. </ div>
  8. </ div>
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
3
3
3
3
3
1
4
4
4
4
4
6
6
8
8
5
11
16

Litšiea tsa offsetting

4
8 ho ​​tloha 4
4 tlhophiso 4
4 tlhophiso 4
5 tlhophiso 3
5 tlhophiso 3
10 ho tloha 6

Sebopeho se tsitsitseng

Sebopeho sa mantlha sa 940px se pharaletseng, se bohareng bakeng sa sebaka kapa leqephe lefe kapa lefe.

  1. <'mele>
  2. <div class = "setshelo" >
  3. ...
  4. </ div>
  5. </ mmele>

Sebopeho sa mokelikeli

Mokelikeli o feto-fetohang kapa sebopeho sa leqephe la metsi le nang le min- le max-widths le lehlakore le letšehali. E ntle bakeng sa lisebelisoa.

  1. <'mele>
  2. <div class = "setshelo-mokelikeli" >
  3. <div class = "sidebar" >
  4. ...
  5. </ div>
  6. <div class = "dikahare" >
  7. ...
  8. </ div>
  9. </ div>
  10. </ mmele>

Lihlooho le kopi

Tsamaiso e tloaelehileng ea typographic bakeng sa ho hlophisa maqephe a hau a tepo.

h1. Sehlooho sa 1

h2. Sehlooho sa 2

h3. Sehlooho sa 3

h4. Sehlooho sa 4

h5. Sehlooho sa 5
h6. Sehlooho sa 6

Serapa sa mohlala

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.

Sehloho sa mohlala Se na le sehloohoana...

Tse ling likarolo

Ho sebelisoa khatiso, liaterese le khutsufatso

<strong> <em> <address> <abbr>

Nako ea ho sebelisoa

Li-tag tsa khatiso ( <strong>le <em>) li lokela ho sebelisoa ho bontša bohlokoa bo eketsehileng kapa khatiso ea lentsoe kapa poleloana e amanang le kopi e potolohileng eona. Sebelisa <strong>bakeng sa bohlokoa le <em>bakeng sa ho hatisa khatello .

Ho hatisoa serapeng

Fusce dapibus , tellus ac cursus commodo , tor mauris condimentum nibh , ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, pharetra augue.

Tlhokomeliso: Ho ntse ho lokile ho sebelisa <b>le <i>li-tag ho HTML5, empa ha li sa tla le mekhoa ea tlhaho. <b>e reretsoe ho totobatsa mantsoe kapa lipoleloana ntle le ho fana ka bohlokoa bo eketsehileng, athe <i>hangata e le ea lentsoe, mantsoe a theknoloji, joalo-joalo.

Liaterese

The <address>element e sebelisetsoa tlhahisoleseling bakeng sa moholo-holo oa eona ea haufi, kapa sehlopha sohle sa mosebetsi. Mona ke kamoo e shebahalang kateng:

Twitter, Inc.
795 Folsom Ave, Suite 600
San Francisco, CA 94107
P: (123) 456-7890

Tlhokomeliso: Mola o mong le o mong o <address>tlameha ho qetella ka ho khaoha ( <br />) kapa o phuthetsoe ka lebokose la "block-level" (mohlala, <p>) ho hlophisa litaba hantle.

Likgutsufatso

Bakeng sa khutsufatso le li-acronyms, sebelisa <abbr>tag ( <acronym>e tlositsoe ho HTML5 ). Kenya foromo e khuts'oane ka har'a tag ebe u beha sehlooho sa lebitso le felletseng.

Mantsoe a thibelang

<blockquote> <p> <small>

Mokhoa oa ho qotsa

Ho kenyelletsa blockquote, thatela <blockquote>hohle <p>le <small>li-tag. Sebelisa <small>element ho qotsa mohloli oa hau mme o tla fumana lebelo la em &mdash;pele ho lona.

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat ante venenatis dapibus posuere velit aliquet.

Ngaka Julius Hibbert

Manane

Ha ea laeloa<ul>

  • Lorem ipsum dolor sit amet
  • Consectetur adipiscing elit
  • Integer molestie lorem le massa
  • Facilisis in pretium nisl aliquet
  • Nulla volutpat aliquam velit
    • Phasellus iaculis neque
    • Likokoana-hloko tsa Purus sodales
    • Vestibulum laoreet porttitor sem
    • Ac tristique libero volutpat at
  • Faucibus porta lacus fringilla vel
  • Aenean sit amet erat nunc
  • Eget porttitor lorem

Unstyled<ul.unstyled>

  • Lorem ipsum dolor sit amet
  • Consectetur adipiscing elit
  • Integer molestie lorem le massa
  • Facilisis in pretium nisl aliquet
  • Nulla volutpat aliquam velit
    • Phasellus iaculis neque
    • Likokoana-hloko tsa Purus sodales
    • Vestibulum laoreet porttitor sem
    • Ac tristique libero volutpat at
  • Faucibus porta lacus fringilla vel
  • Aenean sit amet erat nunc
  • Eget porttitor lorem

E laetsoe<ol>

  1. Lorem ipsum dolor sit amet
  2. Consectetur adipiscing elit
  3. Integer molestie lorem le massa
  4. Facilisis in pretium nisl aliquet
  5. Nulla volutpat aliquam velit
  6. Faucibus porta lacus fringilla vel
  7. Aenean sit amet erat nunc
  8. Eget porttitor lorem

Tlhalosodl

Manane a tlhaloso
Lethathamo la litlhaloso le nepahetse bakeng sa ho hlalosa mantsoe.
Euismod
Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
Donec id elit non mi porta gravida at eget metus.
Malesuada porta
Etiam porta sem malesuada magna mollis euismod.

Ho aha litafole

<table> <thead> <tbody> <tr> <th> <td> <colspan> <caption>

Litafole li ntle - bakeng sa lintho tse ngata. Litafole tse kholo, leha ho le joalo, li hloka lerato la "markup" hore le be molemo, le fokotsehe, 'me le balehe (boemong ba khoutu). Litlhahiso tse 'maloa tse ka u thusang ke tsena.

Ka linako tsohle phuthela lihlooho tsa kholomo ea hau ka tsela <thead>eo bolaoli bo leng teng <thead>> <tr>> <th>.

Joalo ka lihlooho tsa kholomo, litaba tsohle tsa 'mele oa tafole ea hau li lokela ho koaheloa ka hore sehlopha sa <tbody>hau sa maemo ke <tbody>> <tr>> <td>.

Mohlala: Mekhoa ea litafole ea kamehla

Litafole tsohle li tla etsoa ka mokhoa oa boiketsetso ka meeli ea bohlokoa feela ho netefatsa hore li balehe le ho boloka sebopeho. Ha ho hlokahale ho eketsa litlelase kapa litšobotsi tse ling.

# Lebitso la pele Fane Puo
1 Ba bang E 'ngoe Senyesemane
2 Joe Sixpack Senyesemane
3 Stu Sebono Khoutu
  1. < sehlopha sa tafole = "tafole e tloaelehileng" >
  2. ...
  3. </tafole>

Mohlala: Qoaha e metsero

Fumana monate ka litafole tsa hau ka ho eketsa liqoaha-tsenya .zebra-stripedsehlopha.

# Lebitso la pele Fane Puo
1 Ba bang E 'ngoe Senyesemane
2 Joe Sixpack Senyesemane
3 Stu Sebono Khoutu

Tlhokomeliso: Zebra-striping ke ntlafatso e tsoelang pele ha e fumanehe bakeng sa libatli tsa khale joalo ka IE8 le ka tlase.

  1. < sehlopha sa tafole = "tse tloaelehileng-tafole liqoaha tse mebala-bala" >
  2. ...
  3. </tafole>

Mohlala: Zebra-striped w/ TableSorter.js

Ho nka mohlala o fetileng, re ntlafatsa molemo oa litafole tsa rona ka ho fana ka ts'ebetso ea ho hlophisa ka jQuery le plugin ea Tablesorter . Tobetsa sehlooho sa kholomo efe kapa efe ho fetola mofuta.

# Lebitso la pele Fane Puo
1 Hao E 'ngoe Senyesemane
2 Joe Sixpack Senyesemane
3 Stu Sebono Khoutu
  1. <script src = "js/jquery/jquery.tablesorter.min.js" ></script>
  2. <script >
  3. $ ( mosebetsi () {
  4. $ ( "tafole#sortTableExample" ). tablesorter ({ sortList : [[ 1 , 0 ]] });
  5. });
  6. </script>
  7. < sehlopha sa tafole = "tse tloaelehileng-tafole liqoaha tse mebala-bala" >
  8. ...
  9. </tafole>

Mekhoa ea kamehla

Liforomo tsohle li fuoa mekhoa e sa lekanyetsoang ho li hlahisa ka mokhoa o balehang le o ka qhekellang. Litaele li fanoe bakeng sa ho kenya mongolo, ho khetha manane, libaka tsa mongolo, likonopo tsa seea-le-moea le li-checkbox, le likonopo.

Tšōmo ea sebopeho sa mohlala
Boleng bo itseng Mona
Sekhechana se senyane sa mongolo oa thuso
Tšōmo ea sebopeho sa mohlala
@
Tšōmo ea sebopeho sa mohlala
Tlhokomeliso: Li-labels li pota-potile likhetho tsohle bakeng sa libaka tse kholoanyane tsa ho tobetsa le foromo e sebetsang haholoanyane.
ho Linako tsohle li hlahisoa e le Nako e Tloaelehileng ea Pacific (GMT -08:00).
Sengoloa sa thuso se hlalosang karolo e kaholimo ha ho hlokahala.
 

Liforomo tse pakiloeng

Eketsa .form-stackedho HTML ea foromo ea hau 'me u tla ba le li-label ka holim'a masimo a bona ho e-na le ho le letšehali. Sena se sebetsa hantle haeba liforomo tsa hau li le khuts'oane kapa u na le mela e 'meli ea litlatsetso bakeng sa liforomo tse boima.

Tšōmo ea sebopeho sa mohlala
Tšōmo ea sebopeho sa mohlala
Sekhechana se senyane sa mongolo oa thuso
Tlhokomeliso: Li-labels li pota-potile likhetho tsohle bakeng sa libaka tse kholoanyane tsa ho tobetsa le foromo e sebetsang haholoanyane.
 

Likonopo

Joalo ka kopano, likonopo li sebelisetsoa liketso ha lihokelo li sebelisetsoa lintho. Mohlala, "Khoasolla" e ka ba konopo mme "ts'ebetso ea morao-rao" e ka ba sehokelo.

Likonopo tsohle li ikamahanya le setaele se boputsoa bo bobebe, empa mofuta o moputsoa .primaryoa fumaneha. Ho feta moo, ho roala setaele sa hau ho bonolo.

Likonopo tsa mohlala

Mefuta ea likonopo e ka sebelisoa ho eng kapa eng e .btnsebelisitsoeng. Ka tloaelo u tla batla ho sebelisa tsena ho feela <a>, <button>, le ho khetha <input>likarolo. Mona ke kamoo e shebahalang kateng:

 

Mefuta e fapaneng

U batla likonopo tse kholoanyane kapa tse nyane? E etse joalo!

Boemo ba bokooa

Bakeng sa likonopo tse sa sebetseng kapa tse koetsoeng ke sesebelisoa ka mabaka a mang, sebelisa boemo ba batho ba holofetseng. Ke tsa .disabledlihokelo le :disabledtsa <button>likarolo.

Lihokelo

Likonopo

 

Basic alerts

One-line messages for highlighting the failure, possible failure, or success of an action. Particularly useful for forms.

×

Oh snap! Change this and that and try again.

×

Holy gaucamole! Best check yo self, you’re not looking too good.

×

Well done! You successfully read this alert message.

×

Heads up! This is an alert that needs your attention, but it’s not a huge priority just yet.

Block messages

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.

×

Oh snap! You got an error! Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.

Take this action Or do this

×

Holy gaucamole! This is a warning! Best check yo self, you’re not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

Take this action Or do this

×

Well done! You successfully read this alert message. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas faucibus mollis interdum.

Take this action Or do this

×

Heads up! This is an alert that needs your attention, but it’s not a huge priority just yet.

Take this action Or do this

Modals

Modals—dialogs or lightboxes—are great for contextual actions in situations where it’s important that the background context be maintained.

Tool Tips

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.

below!
right!
left!
above!

Popovers

Use popovers to provide subtextual information to a page without affecting layout.

Popover Title

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.

How to use it

Use this option to make full use of Bootstrap’s Less variables, mixins, and nesting in CSS via javascript in your browser.

  1. <link rel="stylesheet/less" href="less/bootstrap.less" media="all" />
  2. <script 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.

What’s included

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.

Color variables

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.

  1. // Links
  2. @linkColor: #8b59c2;
  3. @linkColorHover: darken(@linkColor, 10);
  4.  
  5. // Grays
  6. @black: #000;
  7. @grayDark: lighten(@black, 25%);
  8. @gray: lighten(@black, 50%);
  9. @grayLight: lighten(@black, 70%);
  10. @grayLighter: lighten(@black, 90%);
  11. @white: #fff;
  12.  
  13. // Accent Colors
  14. @blue: #08b5fb;
  15. @green: #46a546;
  16. @red: #9d261d;
  17. @yellow: #ffc40d;
  18. @orange: #f89406;
  19. @pink: #c3325f;
  20. @purple: #7a43b6;
  21.  
  22. // Baseline
  23. @baseline: 20px;

Commenting

Less also provides another style of commenting in addition to CSS’s normal /* ... */ syntax.

  1. // This is a comment
  2. /* This is also a comment */

Mixins up the wazoo

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 stacks

  1. #font {
  2. .shorthand(@weight: normal, @size: 14px, @lineHeight: 20px) {
  3. font-size: @size;
  4. font-weight: @weight;
  5. line-height: @lineHeight;
  6. }
  7. .sans-serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
  8. font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  9. font-size: @size;
  10. font-weight: @weight;
  11. line-height: @lineHeight;
  12. }
  13. .serif(@weight: normal, @size: 14px, @lineHeight: 20px) {
  14. font-family: "Georgia", Times New Roman, Times, sans-serif;
  15. font-size: @size;
  16. font-weight: @weight;
  17. line-height: @lineHeight;
  18. }
  19. .monospace(@weight: normal, @size: 12px, @lineHeight: 20px) {
  20. font-family: "Monaco", Courier New, monospace;
  21. font-size: @size;
  22. font-weight: @weight;
  23. line-height: @lineHeight;
  24. }
  25. }

Gradients

  1. #gradient {
  2. .horizontal (@startColor: #555, @endColor: #333) {
  3. background-color: @endColor;
  4. background-repeat: repeat-x;
  5. background-image: -khtml-gradient(linear, left top, right top, from(@startColor), to(@endColor)); // Konqueror
  6. background-image: -moz-linear-gradient(left, @startColor, @endColor); // FF 3.6+
  7. background-image: -ms-linear-gradient(left, @startColor, @endColor); // IE10
  8. background-image: -webkit-gradient(linear, left top, right top, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
  9. background-image: -webkit-linear-gradient(left, @startColor, @endColor); // Safari 5.1+, Chrome 10+
  10. background-image: -o-linear-gradient(left, @startColor, @endColor); // Opera 11.10
  11. -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor); // IE8+
  12. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)",@startColor,@endColor)); // IE6 & IE7
  13. background-image: linear-gradient(left, @startColor, @endColor); // Le standard
  14. }
  15. .vertical (@startColor: #555, @endColor: #333) {
  16. background-color: @endColor;
  17. background-repeat: repeat-x;
  18. background-image: -khtml-gradient(linear, left top, left bottom, from(@startColor), to(@endColor)); // Konqueror
  19. background-image: -moz-linear-gradient(@startColor, @endColor); // FF 3.6+
  20. background-image: -ms-linear-gradient(@startColor, @endColor); // IE10
  21. background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @startColor), color-stop(100%, @endColor)); // Safari 4+, Chrome 2+
  22. background-image: -webkit-linear-gradient(@startColor, @endColor); // Safari 5.1+, Chrome 10+
  23. background-image: -o-linear-gradient(@startColor, @endColor); // Opera 11.10
  24. -ms-filter: %("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor); // IE8+
  25. filter: e(%("progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)",@startColor,@endColor)); // IE6 & IE7
  26. background-image: linear-gradient(@startColor, @endColor); // The standard
  27. }
  28. .directional (@startColor: #555, @endColor: #333, @deg: 45deg) {
  29. ...
  30. }
  31. .vertical-three-colors(@startColor: #00b3ee, @midColor: #7a43b6, @colorStop: 0.5, @endColor: #c3325f) {
  32. ...
  33. }
  34. }

Operations and grid system

Get fancy and perform some math to generate flexible and powerful mixins like the one below.

  1. // Griditude
  2. @gridColumns: 16;
  3. @gridColumnWidth: 40px;
  4. @gridGutterWidth: 20px;
  5.  
  6. // Grid System
  7. .container {
  8. width: @siteWidth;
  9. margin: 0 auto;
  10. .clearfix();
  11. }
  12. .columns(@columnSpan: 1) {
  13. display: inline;
  14. float: left;
  15. width: (@gridColumnWidth * @columnSpan) + (@gridGutterWidth * (@columnSpan - 1));
  16. margin-left: @gridGutterWidth;
  17. &:first-child {
  18. margin-left: 0;
  19. }
  20. }
  21. .offset(@columnOffset: 1) {
  22. margin - ka ho le letšehali : ( @gridColumnWidth * @columnOffset ) + ( @gridGutterWidth * ( @columnOffset - 1 )) ! bohlokoa ;
  23. }