CSS Position

Position specifies the type of positioning method for an particular element.

Position values are: static, relative, fixed, absolute

Static Example:

position: static; It’s a Default value.
#mybox {
position:static;
width:100px;
height:100px;
background:blue;
padding:20px;
}

Relative Example:

position: realtive; A relative positioned element is positioned relative to its normal position.
#mybox {
position:relative;
width:100px;
height:100px;
background:blue;
padding:20px;
}

Absolute Example:

position:absolute; The element is positioned relative to its first parent element
#mybox {
position:absolute;
width:100px;
height:100px;
background:blue;
padding:20px;
}

Fixed Example:

position:absolute; The element is used for fixed the content in browser.
#mybox {
position:fixed;
width:100px;
height:100px;
background:blue;
padding:20px;
}


Leave a Reply

avatar
  Subscribe  
Notify of