z-index property
Specifies the stack level of positioned objects.
This element is useful if you want to create overlapping elements, like dialogs, tooltips or banners.
Elements with the same z-index are stacked back-to-front according to HTML flow.
The children of a stacked element are at the same stack level, if you want to use some overlap between them, you can use a minimum index of 0.
JavaScript page for this property: zIndex. You can find other example(s) there. |
Possible values:
One of the following values:
Default. Determines the stacking order of the positioned element automatically based on its order in the document. | |||||||
Takes the value of this property from the computed style of the parent element. | |||||||
Integer that specifies the stack level. |
Default: auto.
Example HTML code 1:
This example illustrates the use of the z-index property:
|
||||
<head> <style> .zindex1 { z-index: 1; background-color: #00F9F9; width: 80px; height: 80px; position: absolute; top: 80px; left: 80px; } .zindex2 { z-index: 2; background-color: red; width: 80px; height: 80px; position: absolute; top: 140px; left: 145px; } </style> </head> <body> <div class="zindex2">z-index: 2</div> <div class="zindex1">z-index: 1</div> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by tags:
a, abbr, acronym, address, b, bdo, big, blink, blockQuote, body, button, caption, center, cite, code, col, colGroup, dd, del, dfn, dir, div, dl, dt, em, fieldSet, font, form, H1, H2, H3, H4, H5, H6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isIndex, kbd, label, legend, li, listing, marquee, menu, nobr, ol, p, plainText, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tBody, td, textArea, tFoot, th, tHead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments