Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<head>
<title>CSS Test: font shorthand - reserved keywords</title>
<link rel="author" title="GĂ©rard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" />
<link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com" />
<link rel="help" href="http://www.w3.org/TR/CSS21/fonts.html#font-shorthand" title="15.8 Shorthand font property: the 'font' property" />
<link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-prop" title="3.7 Shorthand font property: the font property" />
<link rel="bookmark" href="http://lists.w3.org/Archives/Public/www-style/2012May/0878.html" title="Re: [css2.1][css3-fonts] keywords in unquoted font family names" />
<meta content="This test verifies different valid and invalid font shorthand declarations involving reserved keywords (caption, inherit)." name="assert" />
<style type="text/css"><![CDATA[
p
{
font-size: 1.5em;
font-family: serif;
}
span#verify1 {font-family: "CSSTest Verify";}
div#verify {font-size: 1.5em;}
div
{
font-size: 2.5em;
line-height: 1.5;
}
/*
font shorthand syntax in CSS 2.1:
Value: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
Brackets ([ ]) are for grouping.
A double bar (||) separates two or more options: one or more of them must occur, in any order.
A question mark (?) indicates that the preceding type, word, or group is optional.
A bar (|) separates two or more alternatives: exactly one of them must occur.
Section 1.4.2.1 Value
*/
div#firstTest {font: 40px \inherit foo, "CSSTest Fallback";}
/* valid: there can be a font whose name is "inherit foo" */
div#secondTest {font: 40px foo \inherit, "CSSTest Fallback";}
/* valid: there can be a font whose name is "foo inherit" */
div#thirdTest {font: caption;}
/* valid: caption is the reserved keyword for the system font */
div#fourthTest {font: medium caption, "CSSTest Fallback";}
/* valid: there can be a font whose name is "caption";
"medium" is the font-size */
div#fifthTest {font: caption foo, "CSSTest Fallback";}
/* invalid: there could be a font whose name is "caption foo"
but then the font shorthand declaration would have no font-size */
div#sixthTest {font: caption, foo, "CSSTest Fallback";}
/* invalid */
div#seventhTest {font: medium caption, inherit, "CSSTest Fallback";}
/* invalid */
/*
font shorthand syntax in CSS 2.1:
Value: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit
Brackets ([ ]) are for grouping.
A double bar (||) separates two or more options: one or more of them must occur, in any order.
A question mark (?) indicates that the preceding type, word, or group is optional.
A bar (|) separates two or more alternatives: exactly one of them must occur.
Section 1.4.2.1 Value
*/
]]></style>
</head>
<body>
<p><a href="http://www.w3.org/Style/CSS/Test/Fonts/">Test fonts</a> must be installed for this test: <span id="verify1">FAIL</span></p>
<div id="verify">User agent's default font must be set to be "CSSTest FamilyName": 5678</div>
<p>Test passes if there are exactly seven "PASS" words below:</p>
<div id="firstTest">1234</div>
<div id="secondTest">1234</div>
<div id="thirdTest">PASS</div>
<div id="fourthTest">1234</div>
<div id="fifthTest">5678</div>
<div id="sixthTest">5678</div>
<div id="seventhTest">5678</div>
</body>
</html>