繁体   English   中英

页眉和页脚背景图片不会在IE8中显示

[英]Header and Footer background images won't show in IE8

好吧,这一直让我发疯。 在IE8中,背景渐变图像不会显示在页眉或页脚中,但会显示其他背景图像。 我在IE9,Firefox,Chrome,Safari或Opera中没有问题。 我已经在这里和其他地方寻找了建议的解决方案,但是到目前为止,没有一个工作。 使用HTML5和CSS3(在较旧的浏览器中有时会很时髦)。

这是页脚的代码:

footer {
text-align:center;
color:#f9f2e7;
font-size:14px; 
display:block;
background: #26b6c9;
background-image:url(images/bg-footer.png);
background-repeat:repeat-x;
background-attachment:scroll;
position:relative;
height:103px;
clear:both;
width:100%;
float:left;
}

这是标题:

header {
background: #26b6c9;
background-image:url(images/bg-header.png);
background-repeat:repeat-x;
background-attachment:scroll;
margin: 0 auto;
position:relative;
height:159px;
width:100%;
float:left;
}

我尝试过display:block和shorhand代码,例如background:url(images / bg-footer.png)repeat-x左上滚动; 但都不起作用。

该站点的测试区域可以在此处找到。 当我注意到此问题时,我正开始将其转换为WordPress模板,因此CSS可能仍然有些混乱。

这是因为您使用的是html5-ie8和更早的版本不支持它。

试试modernizrhtml5 shiv

IE 8及更低版本不了解诸如<header><footer>类的新元素。 您需要在文档标题中使用html5shim之类的格式

尝试将以下内容添加到<head>部分:

<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

因为IE8和更早版本不支持页眉和页脚标签(html5标签)。 您必须先创建它们。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM