bootstrap是個好東西,對於CSS不是很熟悉的同學可以用它快速的做個不丑的網站。
但是bootstrap是個12柵格的系統,顯示5列比較麻煩,今天我也剛好有這個需求,就稍微研究了下,並且成功了。具體的做法是:
在 head 里加載 bootstrap 的 css <link href="http://cdn.staticfile.org/twitter-bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet"> 之后
自己再添加幾個 css class
1 <style> 2 .col-lg-2dot4 { 3 position: relative; 4 min-height: 1px; 5 padding-right: 15px; 6 padding-left: 15px; 7 } 8 @media (min-width: 1200px) { 9 .col-lg-2dot4 { 10 float: left; 11 } 12 .col-lg-2dot4 { 13 width: 20%; 14 } 15 .col-lg-pull-2dot4 { 16 right: 20%; 17 } 18 .col-lg-push-2dot4 { 19 left: 20%; 20 } 21 .col-lg-offset-2dot4 { 22 margin-left: 20%; 23 } 24 } 25 </style>
然后需要顯示 5 列的地方應用這個 class 即可
