Forum Moderators: not2easy
I am having a problem with my z-index in a webpage I am currently developing for a client. Before we get started have a look at the following page and code etc...
<snip>
...What I am trying to do is place the light blue text box (#whitebox) on top of the dark blue background(#blubg_mid). I need #blubg_mid to expand as #whitebox expands to fit the text. However it appears that by placing #blubg_mid as a child of #whitebox it mucks up my z-index. No matter what I do, #blubg_mid always appears above #whitebox.
What can I do to solve this? Or maybe I need to rethink how I get #blubg_mid to expand as #whitebox does, but this was the only way I could think of...
And this is a problem in all browsers and OS so I'm guessing it's something I've done wrong, not necessarily a browser bug.
Thanks, hope someone can help!
Regards,
Ross
[edited by: engine at 10:23 am (utc) on April 27, 2009]
[edit reason] Please see CSS Charter [/edit]
and a warm welcome to these forums. ;)
The use of absolute positioning is rarely needed for page layout and very
often causes problems, as you have, obviously, discovered. ;)
Instead, I would suggest that you try it like this...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css"><title>[specifics]title>
<style type="text/css">
body {
background-color:#b9cde9;
}
img {
display:block;
}
#container {
width:980px;
margin:50px auto;
}
#header {
padding-top: 234px;
background-image:url(images/header_03.jpg);
background-repeat:no-repeat;
}
#header img {
width:980px;
height:37px;
}
#left {
width:188px;
margin-top:20px;
padding-top: 393px;
background-image:url(images/links_box_08.jpg);
background-repeat:no-repeat;
float:left;
}
#left img {
width:187px;
height:125px;
}
#right {
width:775px;
margin-top:21px;
margin-left:12px;
float:left;
display:inline;
}
#right #top {
width:775px;
height:20px;
}
#right #mission {
width:779px;
height:90px;
}
#content {
height:367px;
padding:30px;
margin-bottom:26px;
background-image:url(images/bg_mid.jpg);
overflow:auto;
font-family:arial,helvetica,sans-serif;
font-size:0.9em;
}
</style></head>
<body><div id="container">
<div id="header"><img src="images/quote_a_06.jpg" alt="quote"></div>
<div id="left"><img src="images/news_box_13.jpg" alt="news"></div>
<div id="right">
<img id="top" src="images/bg_top.jpg" alt="top">
<div id="content">
<p>
<strong>
[specifics]</strong>
</p><p>
[specifics]</p><p>
[specifics]</p><ul>
<li>[specifics]</li>
<li>[specifics]</li>
<li>[specifics]</li>
</ul></div><!--end #content -->
<img id="mission" src="images/mission_17.jpg" alt="mission">
</div><!--end #right -->
</div><!--end #container -->
</body>
</html>
[edited by: swa66 at 7:07 pm (utc) on April 27, 2009]
[edit reason] removed specifcs [/edit]