CSS top property

Usage

Used in conjunction with the position property to specify the position of the top of an element.

Values

  • auto - default; the browser calculates the element position
  • [length] - sets the position of the top of the element. Values can be positive or negative
  • [percentage] - sets the position of the top of the element in % from the top of the window

Example

Code:

h2 {
  position: relative;
  top: 100px;
}