BootStrap_02之全域樣式及組件,bootstrap_02全域

來源:互聯網
上載者:User

BootStrap_02之全域樣式及組件,bootstrap_02全域

1、BootStrap指定的四種螢幕尺寸:
 ①超大PC螢幕——lg(large):w>=1200px;
 ②中等PC螢幕——md(medium):1200px>w>=992px;
 ③Pad螢幕——sm(small):992px>w>=768px;
 ④Phone螢幕——xs(extra small):768px>w;
2、BootStrap中的兩種容器:
 ①定寬容器:.container——1170px(lg)、970px(md)、750px(sm)、100%(xs);
 ②變寬容器:.container——100%;
 ③兩種容器都有:before和:after,可以清除子項目的margin和float造成的影響;
3、全域CSS樣式——表格:
 .table——基礎資料表格;
 .table-bordered——帶邊框的表格;
 .table-striped——隔行變色的表格;
 .table-hover——帶滑鼠移至上方效果的表格;
 .table-responsive——響應式表格,必須使用在table的父元素div上;
4、全域CSS樣式——柵格布局系統:
 ①最外層必須是容器類:.container或.container-fluid;
 ②容器中放置行:.row;
 ③行中放置列:.col;
 ④針對不同的螢幕使用不同的列:
  .col-lg-*:適用於超大PC螢幕;
  .col-md-*:適用於中等PC螢幕;
  .col-sm-*:適用於Pad螢幕;
  .col-xs-*:適用於Phone螢幕;
  一個div可以同時聲明多個不同螢幕下的列寬:
   <div class="col-lg-* col-md-* col-sm-* col-xs-*">
 ⑤一行均分為12份,每個列都需要指定自己所佔的份數:
  <div class="col-lg-2 col-md-6 col-sm-8 col-xs-12">
 ⑥每個列都可以指定向右的位移量:,可以實現右錯位的效果:
  <div class=".col-lg/md/sm/xs-offset-1/2/3/4/...">
 ⑦不同的列在不同的螢幕下有不同的適用性:
  .col-lg-*:只適用於LG螢幕;
  .col-md-*:適用於MD/LG螢幕;
  .col-sm-*:適用於SM/MD/LG螢幕;
  .col-xs-*:適用於XS/SM/MD/LG螢幕;
  列的位移適用同樣的規則,對當前螢幕以及更大螢幕有效;
 ⑧可以指定某列在特定尺寸的螢幕下隱藏:
  .hidden-lg/md/sm/xs;
  隱藏只對當前指定的螢幕有效;
 ⑨柵格系統可以嵌套:
  <div class="container">
   <div class="row">
    <div class="col-xs-6">
     <div class="row">
      <div class="col-xs-6"></div>
     </div>
    </div>
   </div>
   </div>
5、全域CSS樣式——表單:
 ①HTML5標準對錶單相關的推薦寫法:
  button必須指定type;
  輸入組件必須有對應的label——為無障礙閱讀準備:
   <label for="xx">example</label>
   <input id="xx">
   <label>
    <input type="radio/checkbox">example
   </label>
 ②BootStrap提供的預設表單:
  <form>
   <div class="form-group">
    <label></label>
    <input class="form-control">
    <span class="help-block"></span>
   </div>
  </form>
 ③BootStrap提供的行內表單:
  <form class="form-inline">
   <div class="form-group">
    <label class="sr-only"></label>
    <input class="form-control">
   </div>
  </form>
 ④BootStrap提供的水平表單:
  <form class="form-horizontal">
   <div class="form-group">
    <div class="col-*-*">
     <label class="control-label"></label>
    </div>
    <div class="col-*-*">
     <label class="form-control"></label>
    </div>
   </div>
  </form>
6、BootStrap組件——表徵圖字型:
 ①表徵圖字型是字型,可以無限縮放、修改文本顏色、背景顏色、陰影...,顯示的內容卻是圖形表徵圖;
 ②表徵圖字型在Web項目中都是作為伺服器端字型來使用——當用戶端訪問頁面時,即時從伺服器下載必須的表徵圖字型:
  @font-face{
   font-family:"Glyphicons Halflings";
   src:url("../fonts/glyphicons-halflings-regular.eot");
  }
  .glyphicon{
   position:relative;
   top:1px;
   display:inline-block;
   font-family:"Glyphicons Halflings";
  }
 ③使用:
  <span class="glyphicon glyphicon-*"></span>
  * span中不能含有任何文本或子標籤;

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.