How to bring a particular HTML element on top of all other element?
Posted by Poster
on 2/20/2009 11:16:45 AM | Views : 19973 | Status : [Member]
By specifying the z-index style attribute of the html element we can bring it to the front of all other html element on the page. The more z-index value, the more weightage is given to the element while displaying it in the browser.
Lets say, you have two html <div> element on the page almost on the same place one after another and have different z-index value.
<div id="div1" style="position: absolute;z-index:1000;">My data</div>
<div id="div2" style="position: absolute;z-index:900;">My data</div>
In the above code, even if the 2nd div (div2) has been placed after 1st div (div1), the first div will appear on the top of the 2nd div because the z-index value of first div (div1) is more than second div (div2).
Found interesting? Add this to: