replaced-elements-001

replaced elements - margin

WeasyPrint

This browser

Assertion
Block-level, replaced elements with margin-left: auto and margin-right: auto should be centered within their respective parent block

Source

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 2 <html>
 3 
 4  <head>
 5 
 6   <title>CSS Test: replaced elements - margin</title>
 7 
 8   <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/">
 9   <link rel="help" href="http://www.w3.org/TR/CSS21/visudet.html#block-replaced-width">
10   <meta name="flags" content="">
11   <meta name="assert" content="Block-level, replaced elements with margin-left: auto and margin-right: auto should be centered within their respective parent block">
12 
13   <style type="text/css">
14   div
15   {
16   background-color: green;
17   margin: 1em;
18   }
19 
20   input
21   {
22   background-color: orange;
23   display: block;
24   margin-left: auto;
25   margin-right: auto;
26   width: auto;
27   }
28   </style>
29 
30  </head>
31 
32  <body>
33 
34   <p>Below, there should be 2 orange boxes horizontally centered within their respective green bars.</p>
35 
36   <div>
37     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="">
38   </div>
39 
40   <form action="">
41     <div>
42       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="">
43     </div>
44   </form>
45 
46  </body>
47 </html>