1

我最近编写了一些代码,其中有几个 jQuery UI 模式对话框。在这些模态对话框中的每一个中,我都不想要 jQuery 提供的默认标题栏,所以我create在对话框代码的函数中使用了这行代码:

$(this).parents(".ui-dialog:first").find(".ui-dialog-titlebar").css("display","none");

然后我只是以这种方式填充模态对话框的内容:

HTML

<div id="helpdialog" class="helpbox">
    <header id="helptitle">Help</header>    
    <p id="helptext">
        The aim of the game is to escape the maze by forming a correct sentence that ends on one of the edges of the grid.<br><br>
        From each square you can only move to one of the highlighted squares. Choose the only word that can correctly follow the word in the square that you are in and click on it.Move one square at a time, forming a sentence, until you reach one of the edges of the grid or until it is impossible to extend your sentence further. Click on Submit.<br><br>
        To undo your selections click on the squares you want to deselect in the reverse order to that in which you selected them (they will be numbered).<br><br>
        If you click on Reveal, the sentence will be shown for two seconds, and then you'll be able to resume playing.<br><br>
        In the Single player game find all of the sentences in the shortest time possible. 
    </p>
</div> 

CSS

#helptitle {
    height: 1.5em;
    width: 100%;
    background-color: #d9d3ed;
    text-align: center;
    font-size: 1.3em;
    font-family: Dejavu, Verdana, Arial, sans-serif;
}
#helptext { 
    font-size: 0.9em;
    padding: .5em;
    font-weight: normal;
    margin-top: 0; 
}

好吧,问题是没有任何 CSS 属性似乎仅在较低版本的 IE 中应用于header标记。不过,标签的 CSS会被应用。在所有其他浏览器中,它工作正常。我需要使用更具体的选择器还是有其他问题?p

4

3 回答 3

1

那是因为<header>标签只支持IE9,而不是以前。

一种解决方案是将 div 中的所有文本定位为标题,然后更具体地定位段落文本,例如

div {
    color:red;
}

div > p {
    color:blue;
}

这是一个jsFiddle示例。

于 2013-04-12T07:23:51.710 回答
1

这需要HTML5 Shiv

于 2013-04-12T07:25:39.630 回答
1

IE 8 及更低版本不对未知元素应用任何样式。在这里查看更多信息。

于 2013-04-12T07:26:29.670 回答