inline-block-non-replaced-width-002

Inline-block non-replaced elements with 'margin-left' and 'margin-right' set to 'auto'

WeasyPrint

This browser

Flags
ahem
Assertion
When 'margin-left' and 'margin-right' are set to 'auto' the used value becomes '0'.

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: Inline-block non-replaced elements with 'margin-left' and 'margin-right' set to 'auto'</title>
 5         <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
 6         <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#inlineblock-width">
 7         <meta name="flags" content="ahem">
 8         <meta name="assert" content="When 'margin-left' and 'margin-right' are set to 'auto' the used value becomes '0'.">
 9         <style type="text/css">
10             #div1
11             {
12                 border: solid black;
13                 height: 2in;
14                 width: 2in;
15             }
16             div div
17             {
18                 background-color: red;
19                 color: blue;
20                 display: inline-block;
21                 font: 1in/1em Ahem;
22                 margin-left: auto;
23                 margin-right: auto;
24             }
25         </style>
26     </head>
27     <body>
28         <p>Test passes if the blue box is in the upper-left corner of the black box and there is no red visible on the page.</p>
29         <div id="div1">
30             <div>X</div>
31         </div>
32     </body>
33 </html>