html – 使用clear时无法解释的空格:两者

前端之家收集整理的这篇文章主要介绍了html – 使用clear时无法解释的空格:两者前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在建立一个Joomla 1.7网站,我正在使用一个图库插件.除了一个问题,这真的很好.在gallery插件中,您可以插入显示在所有图像之上的描述,但每当我使用它时,我会获得大量的空白. @H_301_2@http://imgur.com/FGrGi

@H_301_2@HTML:

<div id="phocagallery" class="pg-category-view" style="width:800px;margin: auto;">
   <div class="pg-category-view-desc">Pictures of the Roskilde Family</div>
   <div id="pg-icons"></div>
   <div style="clear:both"></div>
   <div class="phocagallery-Box-file" style="height:158px; width:120px;">
   <div class="phocagallery-Box-file" style="height:158px; width:120px;">
   <div class="phocagallery-Box-file" style="height:158px; width:120px;">
   <div class="phocagallery-Box-file" style="height:158px; width:120px;">
   <div class="phocagallery-Box-file" style="height:158px; width:120px;">
@H_301_2@如果我删除白色空间消失.我用萤火虫看着我的css,但我不能为我的生活弄清楚为什么它给了我这个白色空间.我使用了Yahoo css-reset.

@H_301_2@编辑:CSS

@H_301_2@div id =“phocagallery”class =“pg-category-view”:

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,blockquote,th,td,p 
{
    margin: 0;
    padding: 0;
}
    body {
    color: #000000;
    font-family: Verdana,Arial,Helvetica,sans-serif;
    font-size: 75%;
    line-height: 1.3;
}
@H_301_2@有人有线索吗?

解决方法

您必须在左侧或右侧有一个侧边栏,其中有一个浮动元素(或者浮动自身). @H_301_2@明确:两者都导致元素在浮动元素下.

@H_301_2@请在此处查看问题:http://jsfiddle.net/9Razw/

@H_301_2@一种解决方案是设置overflow:隐藏在#phocagallery上或者clear:both元素的父级.

猜你在找的HTML相关文章