blob: 8277a2bbfea5625f2d0d02b698006063ec3bf19b [file] [log] [blame]
<!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).
<!-- TODO: Test relative and absolute positions separately from negative and
positive values. -->
<!-- TODO: Test percentage values. -->
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;
<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>