【发布时间】:2015-11-16 04:36:14
【问题描述】:
在 IE 中包含条目的图像下方有不需要的空白 我知道这是最热门的问题之一,并且已经回答了很多次。我真的尝试了我能找到的每一个技巧,但没有任何帮助。 图像的高度越大,空白区域就越大。如果图片高度为100px,则间隙约为200px。
HTML (Wordpress php)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<div id="main">
<ul id="postlist">
<li class="entry">
<div class="content">
<h2>title</h2>
<img src="http://" alt="04" width="681" height="382" class="alignnone size-full wp-image-137">
</div>
</li>
</ul>
</div>
CSS
#main ul {
font-size: 1em;
line-height: 1.4em;
}
#main ul#postlist {
margin: 0;
overflow: hidden;
list-style: none
}
#main ul#postlist li {
overflow: visible;
display: flex;
margin: 0.875em 0.5em;
float: none;
font-size: 1em;
}
#main ul#postlist li .content {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
border: none;
border-top: 1px solid rgba(34, 36, 38, 0.1);
background: none;
margin: 0em;
padding: 1em 1.2em;
box-shadow: none;
font-size: 1em;
border-radius: 0em;
}
img {
display: block;
border: none;
max-width: 100%;
width: auto;
height: auto;
margin: 0;
padding: 0;
}
-
我在CSS下面试过了
img { float: left; vertical-align: bottom;/*or text-bottom or top or middle*/ font-size: 0px; line-height: 1; /*or 0*/}
【问题讨论】:
-
你能显示 html 代码,至少带有 img-tag 和周围的标签吗? (以及那些周围标签的相关css)
-
提取了相关的 HTML 和 CSS!谢谢@MartenKoetsier
-
从
flex的使用来看,我假设你的目标是IE11?如果不是,则之前的 IE 不支持 flex-layout(本机)。更重要的是:img有一些 WordPress 类。据我所知,这些定义了各种 css 属性,具体取决于您使用的主题。如果没有确切地了解正在发生的事情,就不可能说出出了什么问题。您最好的做法是使用IE Developer Toolbar 并找出发生了什么。首先,关注空白属于哪个元素,然后是哪个类导致它。 -
我在 ie 11 中遇到了类似的问题,但没有任何技巧奏效。我的 .content 有
flex-direction: column并将其更改为flex-direction: row修复它
标签: css image internet-explorer