PDA

View Full Version : Question about z-index attribute in style



magicyte
07-10-2008, 06:17 PM
When I was looking at a JavaScript created by jscheuer1 (John), I noticed something about z-index in a style attribute. What does z-index do?

-magicyte

techietim
07-10-2008, 06:27 PM
If X is width, and Y is height, what must Z be? Depth, of course!

If any elements are overlapping, they will stack accordingly based on their z-index. The ones with the higher index will be higher up, the lower index ones will go to the bottom.

codeexploiter
07-11-2008, 03:30 AM
http://developer.mozilla.org/en/docs/Understanding_CSS_z-index
http://msdn.microsoft.com/en-us/library/ms531188.aspx

magicyte
07-14-2008, 05:52 PM
Thanx guys! Man! I never knew that. Finally! I can make images OVERLAP! It's a miracle.

-magicyte

molendijk
07-14-2008, 07:40 PM
Notice that certain elements like select boxes and activeX in IE always have the highest z-index. There's nothing you can do about that.
===
Arie Molendijk

jscheuer1
07-14-2008, 08:00 PM
Notice that certain elements like select boxes and activeX in IE always have the highest z-index. There's nothing you can do about that.
===
Arie Molendijk

I'm not sure what you mean by Active X, it is such a broad category. Something as simple as an element with style filter(s) in IE is technically Active X, but it will still follow the rules and peculiarities for z-index stacking. The select element bug was corrected in IE 7. Iframe in earlier Opera had this problem as well. All Flash in all browsers exhibits this issue unless its wmode is set to transparent. Other object and embed (deprecated) elements can too (in many browsers), but there is often no equivalent to wmode for them, or none that is widely known.

One caveat for z-indexing is that (in the broadest use, including browsers that do not do fixed positioning for all elements, or that do not do it correctly with regard to z-indexing), the elements involved in stacking must both have either position absolute or relative. One can be absolute, the other relative, but each element involved in the stacking process must be one or the other. This is not required in all browsers, but in enough of them to make it an important requirement.

There are other issues involved, but the above takes in the major ones.

molendijk
07-14-2008, 08:18 PM
I'm not sure what you mean by Active X, it is such a broad category.
Not very long ago, <object data=... ></object> gave me a headache. It's windowed in all versions of IE (but I don't know about IE8).
---
Arie.

jscheuer1
07-15-2008, 04:43 AM
Not very long ago, <object data=... ></object> gave me a headache. It's windowed in all versions of IE (but I don't know about IE8).
---
Arie.

Ah well, yes I recall discussing that (or something similar) with you in fact. That (what we were discussing before with the Google page object) would fit into the category of objects that have no wmode setting or equivalent that is widely known, but in this case only as regards IE because it happened to work as desired in other browsers (iframe worked for it in IE though as I recall).

However, I'm not certain what we were discussing before was an Active X object. It appeared to me to merely be an ordinary object element.

molendijk
07-15-2008, 09:39 AM
Ah well, yes I recall discussing that (or something similar) with you in fact. That (what we were discussing before with the Google page object) would fit into the category of objects that have no wmode setting or equivalent that is widely known, but in this case only as regards IE because it happened to work as desired in other browsers (iframe worked for it in IE though as I recall).

However, I'm not certain what we were discussing before was an Active X object. It appeared to me to merely be an ordinary object element.

We were discussing this (http://dynamicdrive.com/forums/showthread.php?t=33911). In IE, there seems to be no way of having windowless elements on top of <object type="text/html"></object>. Notice also that <object type="text/html"></object> provokes an 'ActiveX prompt' in IE when used locally.
===
Arie.

jscheuer1
07-15-2008, 01:05 PM
I'm not sure if that makes it an Active X object. IE gives exactly the same warning for any javascript.

I think the warning for the script tag and for the object tag are similar. You can use an object tag to show an image - harmless. And a script tag to just do a document.write('Hello world!'); - equally harmless. But either one, script or object tag, can be used in IE to run controls on your computer that will trash it. The programmers of IE just never bothered to write in code to tell the difference between harmless and harmful scripts and objects, while apparently they have to a degree for style tags (where only filters and behaviors will trigger this same Active X warning, but then indiscriminately once again for both safe and for harmful ones).