作者aa1235561 (的客)
看板Web_Design
标题[请益] bootstrap
时间Wed Nov 16 14:18:01 2016
各位大大您好,小弟最近使用了bootstrap的grid,然後再快乐的建置中,为了要使用
________ ________ ________
| || || |
| || || |
|div || div || div |
|col-md-4||col-md-4||col-md-4|
| || || |
|________||________||________|
这样的排版,但其实为了要让它里面有padding所以他们是套着一层class = col-md-4的div,然後再去做里面的内容,但里面的内容想要做grid,却发现外层的div的height会变成0,巢状的grid是没办法被使用的,还是有其他的解决方法吗?
_______________
|div = col-md-4 |
|height=0 |
| _____________ |
||section ||
||=col-md-12 ||
|| ||
|| ||
||_____________||
|_______________|
在chrome中的element的栏会看到这个问题,拿掉section的col-md-12就又正常了!请各位大大解惑,感谢感谢再感谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.124.249.107
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Web_Design/M.1479277083.A.A2B.html
1F:→ kevinkung: 贴程式码上来看会比较清楚 11/16 18:51
<div class="col-md-12">
<section cls="col-md-6">
<p>外层的section height = 0</p>
<p>但内层的p有高度</p>
</section>
</div>
※ 编辑: aa1235561 (140.124.249.101), 11/17/2016 10:56:57
2F:→ xdraculax: 中间加个 .row 看看 11/17 19:49
3F:→ xdraculax: div.col-sm-12 > div.row > section.col-sm-6 11/17 19:51
4F:→ frostyjoan: .col-*都有float:left,要记得clear,可以像x大说的加 11/18 01:26
5F:→ frostyjoan: 一层.row(bootstrap有在此class清浮动),或是自己 11/18 01:26
6F:→ frostyjoan: 手动对div clear,或是div加上.clearfix(bootstrap清 11/18 01:26
7F:→ frostyjoan: 浮动的class) 11/18 01:26
8F:→ aa1235561: 各位大大可以了!加了row之後世界太平!!!! 11/18 22:13
9F:→ frostyjoan: 建议你去看一下float,不然未来还是有可能遇到问题却 11/19 09:46
10F:→ frostyjoan: 怎样都找不到 11/19 09:46
11F:→ aa1235561: 我float都有做clear,加了.row就都没事了! 11/19 16:10
12F:→ frostyjoan: 会出现height: 0几乎都是float没清到,但奇怪,我认真 11/19 17:08
13F:→ frostyjoan: 照你的图解或程式码试,都不会height: 0阿 11/19 17:08
14F:→ aa1235561: 我使用的是chrome,会不会是我加了什麽外挂改变到了? 11/20 00:59