caption-vs-table-box-001

Caption border and table border

WeasyPrint

This browser

Assertion
A caption has padding, margin and borders independent of those of its parent table.

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: Caption border and table border</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#model">
 7         <meta name="flags" content="">
 8         <meta name="assert" content="A caption has padding, margin and borders independent of those of its parent table.">
 9         <style type="text/css">
10             #table, #caption
11             {
12                 border: 1px solid black;
13                 padding: 1em;
14             }
15             #caption, #cell
16             {
17                 height: 4em;
18                 width: 4em;
19             }
20             #table
21             {
22                 display: table;
23                 margin-top: 1em;
24             }
25             #caption
26             {
27                 display: table-caption;
28                 margin-bottom: 1em;
29             }
30             #row
31             {
32                 display: table-row;
33             }
34             #cell
35             {
36                 display: table-cell;
37             }
38         </style>
39     </head>
40     <body>
41         <p>Test passes if there are two separate boxes below and the "Filler Text" inside the boxes has the same alignment.</p>
42         <div id="table">
43             <div id="caption">Filler Text</div>
44             <div id="row">
45                 <div id="cell">Filler Text</div>
46            </div>
47         </div>
48     </body>
49 </html>