CSS position

Also see the full, alphabetical list of CSS properties


The CSS position property is used in positioning an element. It can be used in conjunction with the top, right, bottom and left properties to position an element where you want it.

Also see the float property.

Syntax: position: <value>
Possible Values:
  • static - The element flows as normal. The left and top properties don't take effect.
  • relative - The element is offset relative to it's normal position in the flow.
  • absolute - The element is positioned based on it's containing block. The element is taken out of the normal flow. Any subsequent elements will not be impacted - they will appear where they normally would even if the previous element was not offset.
  • fixed - Similar to absolute, but also doesn't move when scrolled.
  • inherit
Initial Value: static
Applies to: All elements except for generated content
Inherited: No
Media: Visual
Example:
div {
  position: fixed;
  top: 20px;
  left: 50px;
  }
Try it yourself!


Also see all CSS properties listed alphabetically


Enjoy this page?

  1. Link to this page (copy/paste into your own website or blog):
  2. Link to Quackit using one of these banner ads.

Thanks for supporting Quackit!

Sponsored Link: Design CODE-FREE Websites