Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CSS and forms

Status
Not open for further replies.

Ecniv

Programmer
Nov 18, 2002
93
EU
Hi,

I came across this problem yesterday whilst making a new section in my webpages.

I am using javascript to replace the innerHTML of an area defined by CSS.

The area (MainContent) was set to a specific width on the first (home) page. Then all the inside is replaced via code, which eventually will support ie and nutscrape, currently only ie.

I switched the inside to a form to display pictures listed in a list box with a button to expand into a main picture. Then I checked my floating menu area to change to another section. Horror! The floating menu section is behind the forms list box. Yet is it above the text also on the form.

Is this a bug with MS that a CSS absolutely positions cannot cover form objects?
Or is it perhaps because the menuarea (css) is defined just before the main content... in which case how come it can cover the text...?


Thanks in advance to any one with info

Vince
 
Try to use z-index style attribute : the tallest it is, the abovest your control will be displayed. Water is not bad as long as it stays out human body ;-)
 
Tried that - set it to 10
No effect.

Just wondered if other people had come across it...


Vince
 
did you try with 255 ? Water is not bad as long as it stays out human body ;-)
 
No, just 10.

Do form elements have a higher Z-index then??

Vince
 
Here is MSDN doc about it :

z-index Attribute | zIndex Property

Sets or retrieves the stacking order of positioned objects.

Syntax

HTML { z-index : vOrder }
Scripting object.style.zIndex [ = vOrder ]

Possible Values

vOrder Variant that specifies or receives one of the following values.auto Default. String that specifies the stacking order of the positioned objects based on the order in which the objects appear in the HTML source.
order Integer that specifies the position of the object in the stacking order.


The property is read/write for all objects except the following, for which it is read-only: currentStyle. The property has a default value of auto. The Cascading Style Sheets (CSS) attribute is not inherited.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see Dynamic Properties.

Remarks

Positive z-index values are positioned above a negative (or lesser value) z-index. Two objects with the same z-index are stacked according to source order. A positive value positions the element above text that has no defined z-index, and a negative value positions it below. Set this parameter to null to remove the attribute.

The zIndex property only applies to objects that have the position property set to relative or absolute.

The property does not apply to windowed controls, such as select objects.

As of Microsoft® Internet Explorer 5.5, the iframe object is windowless and supports the zIndex property. In earlier versions of Internet Explorer, the iframe object is windowed and, like all windowed controls, ignores the zIndex property. If you maintain Web pages that were designed for earlier versions of Internet Explorer that do not support the zIndex property, you might want to redesign the pages, especially if the pages contain iframe objects that are stacked on top of windowed controls, such as select objects. You can use the visibility attribute to hide windowed controls that you want an iframe object to overlap. You can also position windowed controls so that iframe objects do not overlap them.

Input from pointing devices, such as the mouse, does not penetrate through overlapping elements even if the elements are not visible. This is also true for positioned elements with a negative z-index unless:

The parent is a scrolling container (that is, its overflow property is set to auto or scroll).
The parent is positioned (that is, its position property is set to absolute or relative).

Examples

The following examples use the z-index attribute and the zIndex property to change the stacking order of objects.
This example uses an inline style sheet to set the stacking order.

<IMG SRC=&quot;cone.jpg&quot; STYLE=&quot;position:absolute;
top:100px; left:100px; z-index:4&quot;>
<DIV STYLE=&quot;position:absolute; top:100; left:100;
color:red; background-color:beige; font-weight:bold;
z-index:1&quot;>
. . . </DIV>

This example uses inline scripting to set the stacking order.

<IMG ID=&quot;cone&quot; SRC=&quot;cone.jpeg&quot;
STYLE=&quot;position:absolute;top:10px;left:10px;&quot;
onclick=&quot;cone.style.zIndex=1; sphere.style.zIndex=2&quot;>
<IMG ID=&quot;sphere&quot; SRC=&quot;sphere.jpg&quot;
STYLE=&quot;position:absolute;top:1px;left:1px;&quot;
onclick=&quot;cone.style.zIndex=2; sphere.style.zIndex=1&quot;>
Water is not bad as long as it stays out human body ;-)
 
--Quote-----
The property does not apply to windowed controls, such as select objects.


Oh well that answers that then.

Cheers

Vince
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top