Firefox与一些CSS的令人费解的行为

时间:2015-04-05 08:34:05

标签: html css firefox

这个XHTML在我看来被Firefox 34错误地渲染,因为FF不会将类'all'中的font-size声明级联到正文中的表范围。这只是我对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 &lt;table&gt; drop the card font-size spec?</div>
    </body>
</html>

1 个答案:

答案 0 :(得分:2)

你不会误解CSS。它似乎是一种怪癖模式的变化(将<!DOCTYPE html>添加到您要修复的文件的顶部),但我无法找到该特定怪癖的任何规范。