before-after-positioned-004.html (1065B)
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <title>CSS Test: :before/:after pseudo-elements - 'position:relative'</title> 6 <link rel="author" title="James Hopkins" href="mailto:james(at)idreamincode.co.uk"> 7 <link rel="help" href="http://www.w3.org/TR/CSS21/generate.html#before-after-content"> 8 <link rel="match" href="before-after-positioned-004-ref.html"> 9 <meta name="assert" content="Since the restriction on assigning positioning schemes to the :before and :after pseudo elements was lifted in CSS 2.1, this tests whether 'position:relative' can be correctly applied to both pseudo elements."> 10 <style type="text/css"> 11 #test:after, 12 #test:before{ 13 background:blue; 14 content:""; 15 display:block; 16 height:100px; 17 left:0; 18 position:relative; 19 top:-100px; 20 width:50px; 21 } 22 #test:before{ 23 left:50px; 24 top:0; 25 } 26 </style> 27 </head> 28 29 <body> 30 <p>Test passes if there is a square (four equal sides) below.</p> 31 <div id="test"></div> 32 </body> 33 34 </html>