Weekend Training
ASP.NET MVC, HTML 5 weekend training, click here
eBook free

Win Prizes

Social Presence
Twitter Twitter LinkedIn YouTube Google

Like us on Facebook
Top Codes Author
Sun, 01-Feb-2015 Authors
All Time Authors

Latest members | More ...

(Statistics delayed by 5 minutes)

How to bring a particular HTML element on top of all other element?

Posted by Poster under CSS 3 on 2/20/2009 11:16:45 AM | Views : 28819 | 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).

Share this to:

Bookmark It

Comments or Responses

Login to post response