All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

CSS Positioning

CSS Positioning is used to set the position of elementsElements can be positioned using the top, bottom, left, and right properties. However, these properties will not work unless the position property is set first.


Example Of Positioning

div
{
position:absolute;
top:10px;
left:-20px;
}

Positioning Values

  • position:absolute;is used to positioned relative to the first parent element.

  • position:relative;is used to positioned relative to its normal position.

  • position:static;is used to give the default position of an element.

  • position:fixed;is used to fixed the position of an element relative to the browser.

z-index

The z-index property specifies the order of an element means which element should be placed in front other, or behind to others.Its value can be positive or negative

div
{
position:absolute;
top:10px;
left:-20px;
z-index:1;
}
❮ PrevNext ❯