?
Solved

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

Posted on 2008-10-23
3
Medium Priority
?
346 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
[X]
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
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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 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