css - IE7 & IE8 <hgroup> 背景色

标签 css internet-explorer html internet-explorer-7

出于某种奇怪的原因,我在我的网站上设置的任何背景样式(如果有任何区别,都会加载到模态中)在 IE7 或 IE8 中没有呈现。在所有其他(真实)浏览器(包括 IE9)中,这一切看起来都很好。我的代码如下:

<hgroup>
<h6>Request Information Form</h6>
 <a href="#" onClick="closeModal(); return false;"><img src="/images/x-close.png" alt="Close" class="close" /></a>
</hgroup>

我知道除了 <h1>-<h6> 之外你不应该放任何东西在 <hgroup> 内,但我需要这个小的 close img,即使我尝试将它拉出来,我也遇到了同样的问题(再加上它都“似乎”可以验证)。

CSS 是:

hgroup {
position: relative;
width: 668px;
height: 32px;
margin: 0 0 16px;
padding: 14px 14px 0 14px;
background: #B66115 url(/images/modal_header_bckgrnd.png) repeat-x 0 0;
font: normal 20px/20px 'crimson Text',Georgia,serif;
color: #F6F5EE;
}

另外,我已经声明了<hgroup>作为display:block ,我正在使用 IE 垫片。我一直得到的只是白色背景(当我在 block 中有白色文本时,这真的不起作用!)。

在此先感谢您提供的所有帮助。

最佳答案

IE7 和 IE8 不会将 html5 标签名称加载到文档中。任何无法识别的标签都将被忽略。尝试添加一些 javascript 以手动添加它们(或使用类似 modernizr.js 的东西)。

<script>
document.createElement('header');
document.createElement('hgroup');
document.createElement('nav');
document.createElement('section');
document.createElement('article');
document.createElement('aside');
document.createElement('footer');
</script>

关于css - IE7 & IE8 <hgroup> 背景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6154291/

相关文章:

javascript - 为什么不触发不同版本的IE

javascript - 简单的 sum javascript 函数在 IE 中不起作用

html - 使 IE 10 重复 svg 背景

html - 如何检测哪个视频源正在播放 html5 视频

javascript - 从 <select> 选择值时启用文本区域

css - Font Awesome 5.0.13 CSS 错误

javascript - 为网站滚动添加效果

html - 如何使用 XSLT 构建字母 Accordion ?

javascript - 带有左右箭头的文本框-Ionic4

html - 在没有按预期工作之前