问各位大侠关于div浮动的问题_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:46:55
Original
1371 people have browsed it

div float div

div A里面有两个div B和C,A的高度是100%,但当B和C都设为浮动的时候,A的高度就变成0了,有没有办法让A的高度继续使用百分比而不会变成0?或者是B和C的不使用浮动而可以并排显示?

回复讨论(解决方案)

高度不能使用百分比,只有写固定的值。按你的情况,你B,C应该是有高度的(固定值)然后用浮动用完之后记得清除:

float1
flaot2

按上面的写法会出问题
float1
flaot2

上面就多加了一个DIV用于清除浮动,这样就好了。为了兼容性的保险起见你在A这个DIV中加上overflow:hiddden;

高度不能设百分比,没浮动的时候a的高是b和c撑起来的

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!