floats-026.xht (1660B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Margin affects left floated elements</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-07-02 --> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#floats" /> 8 <link rel="match" href="floats-026-ref.xht" /> 9 10 <meta name="assert" content="Right outer edge of left-floating box cannot be to the right of the left outer edge of any right-floating box that is to the right of it." /> 11 <style type="text/css"> 12 div 13 { 14 border: solid 5px black; 15 height: 2in; 16 width: 2in; 17 } 18 span 19 { 20 height: 1in; 21 width: 1in; 22 } 23 #span1 24 { 25 background: blue; 26 float: left; 27 margin-right: 10px; 28 } 29 #span2 30 { 31 background-color: orange; 32 float: right; 33 margin-left: 10px; 34 } 35 </style> 36 </head> 37 <body> 38 <p>Test passes if the blue square is aligned on the left side of the hollow black square and is above the orange, right aligned, square.</p> 39 <div> 40 <span id="span1"></span> 41 <span id="span2"></span> 42 </div> 43 </body> 44 </html>