font-052.xht (3961B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Test: font shorthand - reserved keywords</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="author" title="John Daggett" href="mailto:jdaggett@mozilla.com" /> 11 <link rel="help" href="http://www.w3.org/TR/CSS21/fonts.html#font-shorthand" title="15.8 Shorthand font property: the 'font' property" /> 12 <link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-prop" title="3.7 Shorthand font property: the font property" /> 13 <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" /> 14 15 <meta content="This test verifies different valid and invalid font shorthand declarations involving reserved keywords (caption, inherit)." name="assert" /> 16 17 <style type="text/css"><![CDATA[ 18 p 19 { 20 font-size: 1.5em; 21 font-family: serif; 22 } 23 24 span#verify1 {font-family: "CSSTest Verify";} 25 26 div#verify {font-size: 1.5em;} 27 28 div 29 { 30 font-size: 2.5em; 31 line-height: 1.5; 32 } 33 34 /* 35 font shorthand syntax in CSS 2.1: 36 37 Value: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit 38 39 Brackets ([ ]) are for grouping. 40 41 A double bar (||) separates two or more options: one or more of them must occur, in any order. 42 43 A question mark (?) indicates that the preceding type, word, or group is optional. 44 45 A bar (|) separates two or more alternatives: exactly one of them must occur. 46 47 Section 1.4.2.1 Value 48 http://www.w3.org/TR/CSS21/about.html#value-defs 49 */ 50 51 div#firstTest {font: 40px \inherit foo, "CSSTest Fallback";} 52 /* valid: there can be a font whose name is "inherit foo" */ 53 54 div#secondTest {font: 40px foo \inherit, "CSSTest Fallback";} 55 /* valid: there can be a font whose name is "foo inherit" */ 56 57 div#thirdTest {font: caption;} 58 /* valid: caption is the reserved keyword for the system font */ 59 60 div#fourthTest {font: medium caption, "CSSTest Fallback";} 61 /* valid: there can be a font whose name is "caption"; 62 "medium" is the font-size */ 63 64 div#fifthTest {font: caption foo, "CSSTest Fallback";} 65 /* invalid: there could be a font whose name is "caption foo" 66 but then the font shorthand declaration would have no font-size */ 67 68 div#sixthTest {font: caption, foo, "CSSTest Fallback";} 69 /* invalid */ 70 71 div#seventhTest {font: medium caption, inherit, "CSSTest Fallback";} 72 /* invalid */ 73 74 /* 75 font shorthand syntax in CSS 2.1: 76 77 Value: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit 78 79 Brackets ([ ]) are for grouping. 80 81 A double bar (||) separates two or more options: one or more of them must occur, in any order. 82 83 A question mark (?) indicates that the preceding type, word, or group is optional. 84 85 A bar (|) separates two or more alternatives: exactly one of them must occur. 86 87 Section 1.4.2.1 Value 88 http://www.w3.org/TR/CSS21/about.html#value-defs 89 */ 90 91 ]]></style> 92 93 </head> 94 95 <body> 96 97 <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> 98 99 <div id="verify">User agent's default font must be set to be "CSSTest FamilyName": 5678</div> 100 101 <p>Test passes if there are exactly seven "PASS" words below:</p> 102 103 <div id="firstTest">1234</div> 104 105 <div id="secondTest">1234</div> 106 107 <div id="thirdTest">PASS</div> 108 109 <div id="fourthTest">1234</div> 110 111 <div id="fifthTest">5678</div> 112 113 <div id="sixthTest">5678</div> 114 115 <div id="seventhTest">5678</div> 116 117 </body> 118 </html>