| <!DOCTYPE html> |
| <!-- |
| | "top" property specifies how far an absolutely positioned box's top margin |
| | edge is offset below the top edge of the box's containing block. |
| | For relatively positioned boxes, the offset is with respect to the top edges |
| | of the box itself (i.e., the box is given a position in the normal flow, |
| | then offset from that position according to these properties). |
| | https://www.w3.org/TR/CSS21/visuren.html#position-props |
| --> |
| <!-- TODO: Test relative and absolute positions separately from negative and |
| positive values. --> |
| <!-- TODO: Test percentage values. --> |
| <html> |
| <head> |
| <style> |
| body { |
| font-size: 100px; |
| } |
| div { |
| height: 100px; |
| } |
| .green { |
| color: green; |
| } |
| .blue { |
| color: blue; |
| } |
| .absolutely-positioned { |
| position: absolute; |
| top: 400px; |
| } |
| .relatively-positioned { |
| position: relative; |
| top: -100px; |
| } |
| </style> |
| </head> |
| <body> |
| <div class="green absolutely-positioned">world!</div> |
| <div class="green">Hello,</div> |
| <div><!-- Placeholder for "world!". --></div> |
| |
| <div class="blue relatively-positioned">world!</div> |
| <div class="blue">Hello,</div> |
| </body> |
| </html> |