bootstrap源碼分析----柵格系統

來源:互聯網
上載者:User

標籤:web   selector   ane   通過   style   cto   add   float   strong   

Bootstrap 提供了一套響應式、行動裝置優先的流式柵格系統,隨著螢幕或視口(viewport)尺寸的增加,系統會自動分為最多12列。

bootstrap通過媒體查詢解決不同解析度螢幕下,頁面主內容的寬度問題:

@media (min-width: 1200px){.container:width: 1170px;}

@media (min-width: 992px){.container :width: 970px;}

 @media (min-width: 768px){ .container :width: 750px}  .container {padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto;} 柵格參數

以class-----col-sm-xx為例子

@media (min-width: 768px) {  .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {    float: left;  }  .col-sm-12 {width: 100%; }  .col-sm-11 {width: 91.66666667%; }  .col-sm-10 {width: 83.33333333%;}  .col-sm-9 { width: 75%;}  .col-sm-8 {width: 66.66666667%;}  .col-sm-7 { width: 58.33333333%;}  .col-sm-6 { width: 50%;}  .col-sm-5 { width: 41.66666667%;}  .col-sm-4 { width: 33.33333333%;}  .col-sm-3 {width: 25%;}  .col-sm-2 {width: 16.66666667%;}  .col-sm-1 {width: 8.33333333%;}}

 根據媒體查詢和寬度百分比設定,設定相應class,就能夠設定相應寬度

bootstrap源碼分析----柵格系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.