Firefox 的一些令人费解的行为 CSS
Puzzling behaviour of Firefox with some CSS
在我看来,这个 XHTML 被 Firefox 34 渲染不正确,因为 FF 没有将 class 'all' 中的 font-size 声明级联到 table body 范围内。难道只是我对CSS的误解?请参阅 XHTML 中的注释。
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8"/>
<title>XHTML experiments</title>
<style>
.all {
font-family: Code2000;
font-size: 24pt;
background-color: #00ff80;
text-align: center;
}
td {
text-align: left;
}
.greek {
color: #20198c;
}
*[mood=I]::before { content: "ind."; }
*[mood=i]::before { content: "imper."; }
*[mood=O]::before { content: "opt."; }
*[mood=S]::before { content: "subj."; }
*[tense=r]::after { content: "præs."; }
*[tense=f]::after { content: "fut."; }
*[tense=m]::after { content: "impf."; }
*[tense=R]::after { content: "aorist"; }
*[tense=k]::after { content: "perf."; }
*[tense=Q]::after { content: "plusq"; }
*[voice=A]::after { content: "active"; }
*[voice=M]::after { content: "middle"; }
*[voice=MP]::after { content: "MP"; }
*[voice=D]::after { content: "pass."; }
.comment {
font-size: 16pt;
font-style: italic;
text-align: left;
}
.instruction {
text-align: right;
font-size: 20pt;
font-style: italic;
}
</style>
</head>
<body class="all">
<!-- in the table tag below, if the class="all" be omitted, the word
"douloimen" is shown in a smallish font; but why isn't the
font-size specification of the body class="all" not cascaded
down into it? It seems to be necessary to re-inforce or repeat
the class declaration for the font-size specification to
penetrate the table scope. -->
<table width="100%" class="all">
<tr><td class="greek">douloimen</td><td class="instruction">parse</td></tr>
</table>
<hr id="answer"/>
<span class="greek">doulow</span> [1] <span mood="O" voice="MP"> <span tense="r"></span> </span>
<div class="comment">why does the <table> drop the card font-size spec?</div>
</body>
</html>
你没有误会CSS。这似乎是一种怪癖模式变体(将 <!DOCTYPE html>
添加到文件顶部以进行修复)但我找不到该特定怪癖的任何规范。
在我看来,这个 XHTML 被 Firefox 34 渲染不正确,因为 FF 没有将 class 'all' 中的 font-size 声明级联到 table body 范围内。难道只是我对CSS的误解?请参阅 XHTML 中的注释。
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml;charset=utf-8"/>
<title>XHTML experiments</title>
<style>
.all {
font-family: Code2000;
font-size: 24pt;
background-color: #00ff80;
text-align: center;
}
td {
text-align: left;
}
.greek {
color: #20198c;
}
*[mood=I]::before { content: "ind."; }
*[mood=i]::before { content: "imper."; }
*[mood=O]::before { content: "opt."; }
*[mood=S]::before { content: "subj."; }
*[tense=r]::after { content: "præs."; }
*[tense=f]::after { content: "fut."; }
*[tense=m]::after { content: "impf."; }
*[tense=R]::after { content: "aorist"; }
*[tense=k]::after { content: "perf."; }
*[tense=Q]::after { content: "plusq"; }
*[voice=A]::after { content: "active"; }
*[voice=M]::after { content: "middle"; }
*[voice=MP]::after { content: "MP"; }
*[voice=D]::after { content: "pass."; }
.comment {
font-size: 16pt;
font-style: italic;
text-align: left;
}
.instruction {
text-align: right;
font-size: 20pt;
font-style: italic;
}
</style>
</head>
<body class="all">
<!-- in the table tag below, if the class="all" be omitted, the word
"douloimen" is shown in a smallish font; but why isn't the
font-size specification of the body class="all" not cascaded
down into it? It seems to be necessary to re-inforce or repeat
the class declaration for the font-size specification to
penetrate the table scope. -->
<table width="100%" class="all">
<tr><td class="greek">douloimen</td><td class="instruction">parse</td></tr>
</table>
<hr id="answer"/>
<span class="greek">doulow</span> [1] <span mood="O" voice="MP"> <span tense="r"></span> </span>
<div class="comment">why does the <table> drop the card font-size spec?</div>
</body>
</html>
你没有误会CSS。这似乎是一种怪癖模式变体(将 <!DOCTYPE html>
添加到文件顶部以进行修复)但我找不到该特定怪癖的任何规范。