简体   繁体   English

IE7 和 IE8<hgroup> 背景颜色</hgroup>

[英]IE7 & IE8 <hgroup> background color

For some odd reason any background styles I set on my (being loaded within a modal if that makes any difference) are not rendering in IE7 or IE8.出于某种奇怪的原因,我在我的设备上设置的任何背景 styles(如果有任何区别,则在模式中加载)都不会在 IE7 或 IE8 中呈现。 It all looks completely fine in all other (real) browsers (including IE9).在所有其他(真实)浏览器(包括 IE9)中,这一切看起来都很好。 My code is as follows:我的代码如下:

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

I know you aren't supposed to put anything besides <h1>-<h6> within an <hgroup> , but I need this little close img in there, and even when I've tried pulling it out, I ran into the same problem (plus it all "seems" to validate).我知道除了<h1>-<h6>之外,您不应该在<hgroup>中放置任何东西,但是我需要在其中放置这个小的接近 img,即使我尝试将其拉出,我也遇到了同样的问题问题(加上这一切“似乎”都可以验证)。

The CSS is: 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;
}

Also, I have declared <hgroup> as display:block , and I am using the IE shim.另外,我已将<hgroup>声明为display:block ,并且我正在使用 IE shim。 All I keep getting is a white background (which really doesn't work when I have white text in the block.).我一直得到的只是一个白色背景(当我在块中有白色文本时,它真的不起作用。)。

Thanks in advance for any and all help.提前感谢您的任何帮助。

IE7 and IE8 do not load html5 tag names into the document. IE7 和 IE8 不会将 html5 标记名称加载到文档中。 Any unrecognized tags are ignored.任何无法识别的标签都会被忽略。 Try adding a bit of javascript to manually add them (or use something like modernizr.js).尝试添加一点 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>

being loaded within a modal if that makes any difference如果这有什么不同,则在模态中加载

Does your modal window use an iframe ?您的模态 window 是否使用iframe

If so, you also need to run your HTML5 element shim script inside the iframe .如果是这样,您还需要在 iframe 中运行iframe元素 shim 脚本。

Use the HTML5 Shiv .使用HTML5 Shiv

On a slightly unrelated note, you're using <hgroup> incorrectly.在稍微不相关的说明中,您使用<hgroup>不正确。 It's only supposed to contain one or more hN elements, and nothing more.它应该只包含一个或多个 hN 元素,仅此而已。

Using your code above, you should be using <header> instead.使用上面的代码,您应该改用<header>

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

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