inherited-value-002

Inheriting computed values

WeasyPrint

This browser

Flags
ahem
Assertion
The computed value of a font-size with a percentage is the percentage of its parent's font-size value. A nested element which also has a percentage applies the parents' specified value (which is inherited).

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: Inheriting computed values</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/cascade.html">
 7         <meta name="flags" content="ahem">
 8         <meta name="assert" content="The computed value of a font-size with a percentage is the percentage of its parent's font-size value. A nested element which also has a percentage applies the parents' specified value (which is inherited).">
 9         <style type="text/css">
10             .container
11             {
12                 font-family: Ahem;
13                 font-size: 96px;
14             }
15             div div
16             {
17                 background: blue;
18                 height: 48px;
19                 width: 48px;
20             }
21             div p
22             {
23                 font-size: 50%;
24             }
25         </style>
26     </head>
27     <body>
28         <p>Test passes if the black box and the blue box are the same width.</p>
29         <div class="container">
30             <p>X</p>
31             <div></div>
32         </div>
33     </body>
34 </html>