Solved

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

Posted on 2008-10-23
3
339 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

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

Suggested Solutions

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
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 add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

809 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