图像出现下的神秘差距

时间:2012-06-15 20:14:51

标签: html css image

  

可能重复:
  White space at bottom of anchor tag

点击此示例页面.. http://denise.brixwork.com/

由于一些奇怪的原因,在那个家族的那张照片中,在包含图像的灰色边框(5px#333)div之前有一个间隙。我删除了所有边距,填充等,它仍然不会消失。 :(

如果没有在#index_content div上设置一个固定的高度,我不想要以后必须重新调整图像大小(这意味着我的工作量增加一倍),如何在离开时删除该间隙它有弹性吗?

我的HTML代码:

<div id="index_content_container">
    <div id="index_content">
        <img src="http://denise.brixwork.com/images/index_photo.jpg" alt="Real Whistler Living - Real Estate for the Next Generation" />
    </div>
    <div class="clear"></div>
</div>

CSS:

/* INDEX PAGE SPECIAL CSS */
#index_content_container {
    position: relative;
    width: 970px;
    border: 5px solid #e1bb14;
    left: -20px;
    display: block;
    float: left;
    padding: 0px;
    margin: 0px;
}

#index_content {
    position: relative;
    width: 960px;
    border: 5px solid #333;
    float: left;
    display: block;
    padding: 0px;
    margin: 0px;
}

#index_content img {
    padding: 0px;
    border: none;
    margin: 0px;
    clear: none;
}

2 个答案:

答案 0 :(得分:5)

试试这个:

#index_content img{
padding: 0px;
border: none !important;
margin: 0px;
clear: none;
display: block;
}

答案 1 :(得分:4)

您的display: block代码中只需要img,其他内容<=}