0

我正在查看的样式表中有以下几行(单独的):

.Ex1.Ex2 {
color:#333;
font-family:Verdana,Arial,sans-serif;
font-size:9pt;
font-weight:bold;
margin:24px 0 5px;
border-bottom:1px solid #333
}

{
background-color:#ffe;
border:1px solid #aaa;
color:#000;
font-family:Verdana,Arial,sans-serif;
font-size:9pt;
height:auto;
margin-top:5px
}

.box_title_container {
height:29px;
width:225px;
margin:0 auto;
background:url(../best_images/boxts.gif);
repeat-x
}

通过 W3C 验证器时,两者都返回解析错误。由于创建样式表的人在 CSS 方面比我有更多的经验,我可能认为这是两种用于跨浏览兼容性的 hack,但我无法谷歌(现在它是一个动词,对吗?)与此相关的任何内容。

至于第一行,它有两个封闭的属性集,第二行有一个独立的 repeat-x 值(并且这个“错误”在接下来的 5 或 6 行中重复)。

有人能告诉我这些是出于某种目的还是纯粹的错误?

提前致谢!

4

1 回答 1

3

在您的第一个 CSS 块中,您必须为第二个 {} 指明 ID、类或 HTML 元素

.Ex1.Ex2 {
color:#333;
font-family:Verdana,Arial,sans-serif;
font-size:9pt;
font-weight:bold;
margin:24px 0 5px;
border-bottom:1px solid #333 /* missing ;*/
}

#IDneeded .CLASSneeed {
background-color:#ffe;
border:1px solid #aaa;
color:#000;
font-family:Verdana,Arial,sans-serif;
font-size:9pt;
height:auto;
margin-top:5px /* missing ;*/
}

对于第二个,“repeat-x”是“background”的值,而不是 CSS 属性,只需移动 ;

.box_title_container {
height:29px;
width:225px;
margin:0 auto;
background:url(../best_images/boxts.gif) repeat-x;
}
于 2012-11-29T15:48:38.420 回答