| Start | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Overlapping Elements with z-index To change the default stack order (opens new window) positioned elements ( The higher the z-index, the higher up in the stacking context (on the z-axis) it is placed. ExampleIn the example below, a z-index value of 3 puts green on top, a z-index of 2 puts red just under it, and a z-index of 1 puts blue under that. HTMLCSSThis creates the following effect: See a working example at JSFiddle (opens new window). Syntax
RemarksAll elements are laid out in a 3D axis in CSS, including a depth axis, measured by the Read about the z-index property and Stacking Contexts in the CSS Specification (opens new window) on layered presentation and at the Mozilla Developer Network (opens new window). |
||||||||||||||||||
| Absolute Position When absolute positioning is used the box of the desired element is taken out of the Normal Flow and it no longer affects the position of the other elements on the page. Offset properties:
specify the element should appear in relation to its next non-static containing element. This code will move the box containing element with attribute |
||||||||||||||||||
| Fixed position Defining position as fixed we can remove an element from the document flow and set its position relatively to the browser window. One obvious use is when we want something to be visible when we scroll to the bottom of a long page. |
||||||||||||||||||
| Relative Position Relative positioning moves the element in relation to where it would have been in normal flow .Offset properties:
are used to indicate how far to move the element from where it would have been in normal flow. This code will move the box containing element with attribute class="relpos" 20px down and 30px to the right from where it would have been in normal flow. |
||||||||||||||||||
| Static positioning The default position of an element is
Syntax
Parameters
RemarksNormal Flow is the flow of elements if the position of element is static.
|
Read Article
https://develop.horje.com/learn/1434/reference