The top
property in CSS goes hand in hand with positioning. By default, elements are static
positioned in which the top
property has no effect whatsoever. But when the positioning of an element is relative
, absolute
, or fixed
, the top
value plays a big role.
div {
top: value (px, em, %, pt, etc) || auto || inherit; /* can be negative */
}
The value for top
is any of the valid lengths of CSS.
"The Nudge" (Relative Position)