Is the z-index important when the divs don't overlap?

Posted on 2008-10-23
Last Modified: 2008-10-24
Trying to move away from tables to divs for layout and was wondering how important are the z-values.  For example, if the divs do not overlap, does it matter what their z-value is in the even someone resizes the window?  Or if I have two that overlap, is it ok if I set all z-values to 0 and the one that overlaps to 1?
Question by:BendOverIGotYourBack
  • 2
LVL 42

Expert Comment

by:David S.
ID: 22789640
Leaving z-index at its default value is usually fine.
LVL 44

Accepted Solution

scrathcyboy earned 125 total points
ID: 22792191
"does it matter what their z-value is in the even someone resizes the window?  Or if I have two that overlap, is it ok if I set all z-values to 0 and the one that overlaps to 1?"

certainly it does.  If the person resizes the browser or has a small display, you need to account for any potential overlap.  So assign each DIV a Z-index according to importance -- for example, DIVS with links will have more importance than DIVs with background or with text in most cases.

Remember that flash and iframes will demand the highest z-index and some browsers (IE6 for example0 will not put one of your normal DIVs above the z-index of that flash element or otherwise.  You need to be prepared for this -- also consider tablets and iphone displays, and other tiny screens -- overlap is almost guaranteed on them so plan in advance.
LVL 42

Expert Comment

by:David S.
ID: 22799100
I suppose I should explain why my reply was so different. The answer really depends on how much absolute positioning you use and where you use it. The main thing is to prevent overlaps from causing a problem, but I for one, try to prevent them from happening at all, thus to me at least z-index isn't so important.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML and CSS for a complex page 20 57
Printing a Google Form 2 25
CSS Question 5 38
Centering Vertically 3 27
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now