Solved

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

Posted on 2008-10-23
3
330 Views
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?
0
Comment
Question by:BendOverIGotYourBack
  • 2
3 Comments
 
LVL 42

Expert Comment

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

Accepted Solution

by:
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.
0
 
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.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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 embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

705 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

19 Experts available now in Live!

Get 1:1 Help Now