blocks-025

Percentage Dimensions in Shrink Wrap Blocks

WeasyPrint

This browser

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html lang="en">
 3 <head>
 4   <title>CSS Test: Percentage Dimensions in Shrink Wrap Blocks</title>
 5   <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch">
 6   <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/block/015.html" type="text/html">
 7   <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#the-width-property">
 8   <style type="text/css">
 9    body, html { margin: 0 0 0 1em; padding: 0; }
10    p { margin: 1em 0; height: 2em; }
11    table, .float, .abspos, .fixpos { border: 0.25em solid; background: red; }
12    table, td { padding: 0; border-spacing: 0; }
13    .float { float: left; }
14    .fixpos { position: fixed; left: 7.5em; top: 4em; }
15    .abspos { position: absolute; left: 7.5em; top: 9.5em; }
16    .testA { width: 5em; height: 5em; background: green; }
17    .testB { width: 20%; height: 20%; background: red; }
18   </style>
19  </head>
20  <body>
21   <p>There should be four green squares below making a green square pattern.</p>
22   <table><tbody><tr><td>
23    <div class="testA"></div>
24    <div class="testB"></div>
25   </td></tr></tbody></table>
26   <div class="float">
27    <div class="testA"></div>
28    <div class="testB"></div>
29   </div>
30   <div class="fixpos">
31    <div class="testA"></div>
32    <div class="testB"></div>
33   </div>
34   <div class="abspos">
35    <div class="testA"></div>
36    <div class="testB"></div>
37   </div>
38  
39 
40 </body>
41 </html>