numbers-units-012

Em size with font-size set to ex

WeasyPrint

This browser

Flags
ahem
Assertion
The 'em' unit is equal to the computed value of the 'font-size' property (ex) of the element on which it is used.

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3     <head>
 4         <title>CSS Test: Em size with font-size set to ex</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/syndata.html#length-units">
 7         <meta name="flags" content="ahem">
 8         <meta name="assert" content="The 'em' unit is equal to the computed value of the 'font-size' property (ex) of the element on which it is used.">
 9         <style type="text/css">
10             #parent
11             {
12                 font: 20px/1 Ahem;
13             }
14             #div1
15             {
16                 font-size: 6ex;
17             }
18             #test
19             {
20                 background: black;
21                 height: 1em;
22                 width: 1em;
23             }
24             div
25             {
26                 margin-top: 5px;
27             }
28             #reference
29             {
30                 background: black;
31                 height: 1in;
32                 width: 1in;
33             }
34         </style>
35     </head>
36     <body>
37         <p>Test passes if the three boxes below are the same size.</p>
38         <div id="parent">
39             <div id="div1">
40                 <div id="test"></div>
41                 <div>X</div>
42                 <div id="reference"></div>
43             </div>
44         </div>
45     </body>
46 </html>