gpt4 book ai didi

html - 1 行中有 5 个相等的跨度 - Twitter Bootstrap

转载 作者:太空狗 更新时间:2023-10-29 15:25:07 25 4
gpt4 key购买 nike

使用流体网格布局我可以获得 4 个相等的跨度:

<div class="row-fluid">
<div class="span3">...</div>
<div class="span3">...</div>
<div class="span3">...</div>
<div class="span3">...</div>
</div>

或者我可以获得 6 个相等的跨度:

<div class="row-fluid">
<div class="span2">...</div>
<div class="span2">...</div>
<div class="span2">...</div>
<div class="span2">...</div>
<div class="span2">...</div>
<div class="span2">...</div>
</div>

但是我如何获得 5 个相等的跨度?

最佳答案

我遵循了用于计算宽度的 bootstraps 方法,并得出了以下结果。您需要遵循如下的 HTML 结构:

<div class="row-fluid-5">
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
<div class="span2">Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum Lorem ipsum</div>
</div>

然后,在加载 bootstrap.css 和 bootstrap-responsive.css 之后,使用以下内容加载 custom.css 文件:

/* CUSTOM 5 COLUMN SPAN LAYOUT
*
* based on http://gridcalculator.dk/
* width => 1200, gutter => 15px, margin => 15px, columns => 5
*/
.row-fluid-5 {
width: 100%;
*zoom: 1;
}
.row-fluid-5:before,
.row-fluid-5:after {
display: table;
line-height: 0;
content: "";
}
.row-fluid-5:after {
clear: both;
}
.row-fluid-5 [class*="span"] {
display: block;
float: left;
width: 100%;
min-height: 30px;
margin-left: 1.875%;
*margin-left: 1.875%;

-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

.row-fluid-5 .controls-row [class*="span"] + [class*="span"] {

margin-left: 1.875%;
}
.row-fluid-5 [class*="span"]:first-child{
margin-left: 0;
}
.row-fluid-5 .span2 {
width: 18.5%;
*width: 18.5%;
}

/* responsive ONLY */

@media (max-width: 600px){ /* spans reduce to 100px then go full width */

.row-fluid-5 [class*="span"]{
margin-left: 0;
float: left;
width: 100%;
padding: 10px;
}
}

查看下面的演示以了解其工作原理。

DEMO

关于html - 1 行中有 5 个相等的跨度 - Twitter Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15104049/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com