微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我正在建立一个Joomla 1.7网站,我正在使用一个图库插件.除了一个问题,这真的很好.在gallery插件中,您可以插入显示在所有图像之上的描述,但每当我使用它时,我会获得大量的空白.

http://imgur.com/FGrGi

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;">

如果我删除白色空间消失.我用萤火虫看着我的css,但我不能为我的生活弄清楚为什么它给了我这个白色空间.我使用了Yahoo css-reset.

编辑:CSS

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;
}

有人有线索吗?

解决方法

您必须在左侧或右侧有一个侧边栏,其中有一个浮动元素(或者浮动自身).

明确:两者都导致元素在浮动元素下.

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

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

原文地址:https://www.jb51.cc/html/231934.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐