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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
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 users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

763 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