Select Chapter ❯
CSS Tutorial
- CSS Introduction
- CSS Syntax
- CSS Insert CSS
- CSS Backgrounds
- CSS Text
- CSS Dimensions
- CSS Border
- CSS Margin
- CSS Padding
- CSS Display
- CSS Positioning
- CSS Float
- CSS Pseudo-Class
- CSS Opacity
- CSS Media Types
CSS3 Tutorial
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; }