Connecting Tech Pros Worldwide Forums | Help | Site Map

DIV and zIndex

Newbie
 
Join Date: Oct 2008
Posts: 2
#1: Oct 28 '08
Im trying to show a text box above a div in a simple webpage.
Im viewing in IE 7 and Chrome and the text box is always below the div, although I have set the zIndex fairly high.
I have included my code.
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
  2. <html xmlns="http://www.w3.org/1999/xhtml" > 
  3. <head> 
  4. <title>Untitled Page</title> 
  5. <style type="text/css"> 
  6. #Text1 
  7. width: 244px; 
  8. </style> 
  9. </head> 
  10. <body> 
  11. <div id="myMainDiv" style="BORDER-RIGHT: 1px; BORDER-TOP: 1px; BORDER-LEFT: 1px; WIDTH: 800px; BORDER-BOTTOM: 1px; POSITION: relative; HEIGHT: 600px; BACKGROUND-COLOR: buttonface;" > 
  12. <div id="myChildDiv" style="DISPLAY: inline; FONT-SIZE: 8pt; LEFT: 74px; WIDTH: 320px; COLOR: windowtext; FONT-FAMILY: Arial; POSITION: absolute; TOP: 12px; HEIGHT: 212px; BACKGROUND-COLOR: #c0ffff" tag=""></div> 
  13. <input id="Text1" style="z-index: 1000" type="text" /> 
  14. </div> 
  15. </body> 
  16. </html>

Newbie
 
Join Date: Oct 2008
Posts: 2
#2: Oct 28 '08

re: DIV and zIndex


I have it.

I set my zIndex on my nested Div to be -1 and it all worked.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,948
#3: Oct 28 '08

re: DIV and zIndex


Glad you got that sorted.

Remember when you post code in the forums to wrap it in [code] tags. Simply highlight the text to be formatted, then hit the # button on the menu.

Thanks.
Reply