Tuesday 23 July 2013

CSS Position Property

Written By:-Avinash Malhotra
Our Website:- Tech Altum

CSS POSITION PROPERTY

Position means where an element should be placed. Positions are used to specify a page layout.
In CSS we have four type of position:
  • Static
  • Relative
  • Absolute
  • Fixed

Position:Static

Position static is its default value. Means it renders the position in the normal order of things, as they appear in the HTML Document.
For Exp:
Div with position Static

Position:Relative

Position Relative means with respect to the actual position.
For Exp:
Div with position relative only.
Div with position relative and left 200px

Position:Absolute

Position Absolute remove the element from normal flow and shows all of its own. AN element with position can be placed anywhere on the page using properties top, left, right and bottom. An element with position absolute can come in-front of its nearby elements.
For Exp:


Div with position Absolute.

Position:Fixed

Position Fixed means same like absolute, but during scrolling, the element will never move. It will adhere to the window permanently.
For Exp: The chat window in following website

No comments: