Skip to content

Instantly share code, notes, and snippets.

The top, bottom, left, and right properties are used with position to set the placement of an element. They only have an effect on positioned elements, which are elements with the position property set to anything other than static. For example: relative, absolute, fixed, or sticky.

div {
  :  ||  || auto || inherit;
}

You might use it, for example, to nudge an icon into place:

button .icon {
 position: relative;
@missmatsuko
missmatsuko / top.md
Last active October 3, 2019 21:51 — forked from chriscoyier/top.md

The top property is used with position to set the top placement of an element. It only has an effect on positioned elements, which are elements with the position property set to anything other than static. For example: relative, absolute, fixed, or sticky.

Syntax

div {
  top: <length> || <percentage> || auto || inherit;
}