abspos-009.xht (1205B)
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: Right alignment with position:right</title> 5 <link rel="author" title="Ian Hickson" href="mailto:ian@hixie.ch"/> 6 <link rel="author" title="Elika J. Etemad" href="http://fantasai.inkedblade.net/contact"/> 7 <link rel="reviewer" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> <!-- 2012-09-08 --> 8 <link rel="alternate" href="http://www.hixie.ch/tests/adhoc/css/box/absolute/012.html" type="text/html"/> 9 <link rel="help" href="http://www.w3.org/TR/CSS21/visuren.html#comp-abspos"/> 10 <link rel="match" href="abspos-009-ref.xht" /> 11 12 <style type="text/css"> 13 body { position: relative; } 14 .control { border-right: 10em solid red; height: 1em; } 15 .test { position: absolute; width: 10em; height: 1em; 16 right: 0; margin: auto; 17 background: green; color: white; } 18 </style> 19 </head> 20 <body> 21 <p>Test passes if there is a green stripe on the right and <strong>no red</strong>.</p> 22 <div class="test"></div> 23 <div class="control"></div> 24 25 </body> 26 </html>