Forum Moderators: not2easy

Message Too Old, No Replies

Positioning simple box

         

zackattack

4:43 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



Hi this is really simple, but cant figure out why I can't positon the navigation on the left in MISE using absolute positioning, when it's parent has relative positioning - it works fine in FF

CSS:

#wrap {
position: relative;
background-color: green;
margin: 0;
}
#header {
background-color: #eee;
}

#content {
position: relative;
text-align: left;
margin: 0 0 0 0;
padding: 0;
background-color: blue;
}

#pagecontent {
margin-left: 130px;
margin-right: 10px;
background: #fff;
padding: 10px;
}

#mainav {
position: absolute;
top: 0;
left: 10px;
background-color: black;
width: 96px;
}
#mainav ul {
padding: 0;
margin: 0;
list-style: none;
}

HTML:

<body>
<div id="wrap">
<div id="header">
Lorem ipsum dolor sit amet..........
</div>
<div id="content">
<div id="pagecontent">
<p>Lorem ipsum dolor sit amet.........</p>
</div>
<div id="mainav">
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
</ul>
</div>
</div>
</div>
</body>

any ideas?

ZA

D_Blackwell

5:38 pm on Jun 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Put some content or height: to #content, and #mainav will pop into place in IE.

#content {
position: relative;
text-align: left;
margin: 0 0 0 0;
padding: 0;
background-color: blue; height: 100%;
}

zackattack

5:58 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



Thankyou D_Blackwell

Is this because absolute positioning removed the #mainnav from the flow of the document?

It seems i.e. cannot look for a parent, unless I do what you have suggested, and had therefore used the paragraph inside #pagecontent as a surrogate parent

It would be useful to understand why I had this problem if its easy to explain

It works though, thank you very much

ZA

D_Blackwell

6:22 pm on Jun 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Much as I would like to be, I'm not the best person to correctly explain the why in this situation. I simply don't explain positioning very well, even when it's straight forward. Perhaps that means I don't understand it well enough myself. At first glance, it looks as if its just another IE thing in this case.

I just started by looking for the likliest solution. The first thing that I did was put some height on all the IDs to see what might break loose, and there it was. Then it just took a second to backtrack and isolate the issue.

zackattack

6:52 pm on Jun 10, 2005 (gmt 0)

10+ Year Member



Thank you for your time I appreciate it..

Some times it is a bit like finding ones way in the dark, allot of doing things until it works but not always understanding why... often I find I can get my head around css better when I understand the thinking behind it

Thanks again

ZA