【发布时间】:2014-07-18 15:49:26
【问题描述】:
我有一个可以根据窗口大小进行缩放的图像。它在 IE9+、Chrome、Safari 和 Firefox 上运行良好,但在 IE8 或更早版本上不显示。
HTML 代码:
<div class="home_main">
<img src="main_blur.jpg"/>
<div class="text_and_button">
<p>Some text</p>
<p> more text</p>
<a href="Contacts.php" class="contact_button">Button text</a>
</div>
</div>
我的 CSS 代码:
.home_main {
position: relative;
width: 100%;
padding-bottom: 31%;
float: left;
height: 0;
}
.home_main img {
min-height: 300px;
width: 100%;
height: 100%;
position: absolute;
left: 0;
}
.home_main p {
padding: 30px 50px 20px 50px;
color: #FFFFFF;
background: rgb(66,91,122);
background: rgba(66,91,122,.6);
font-size: 54px;
font-family: BebasNeue;
font-weight: normal;
}
此外,段落应该有彩色背景,并且页面顶部的菜单不会出现。
您可以在www.mediata-sa.pt查看问题。
我该如何解决这个问题?
【问题讨论】:
-
可以添加display:block;
-
@AlexWilson 刚刚尝试了您的解决方案,但问题仍然存在。
-
为什么容器上有
height: 0;?我删除了这个,它并没有产生明显的差异
标签: html css internet-explorer internet-explorer-8