防止我的容器中的0px高度div

时间:2016-03-07 09:44:48

标签: css css3 clearfix

在我的主页上,我们有4个容器div来保存我们的图像和内容。页面显示并且看起来很好,但是当我使用“inspect element”将鼠标悬停在每个容器上时,div宽度显示正常,但高度显示为0px。

我是否需要添加clearfix来解决此问题或者高度:auto?是在CSS中自动定义clearfix还是我需要将它添加到我的样式表?对我来说,Clearfix似乎总是很模糊。

显示:当添加到每个div时,内联块似乎填满了高度。但不确定这是否适合添加浮动:左。

我已经粘贴了下面的每个div和css

<div class="category-4">
clear: both;
width: 100%;

<div class="mydownloads">
width: 100%;
margin-top: 17px;


<div class="category-2">

clear: both;
width: 100%;

<div class="category-3">

clear: both;
width: 100%;


<div class="mybrands">
clear: both;
width: 100%;

0 个答案:

没有答案