Welcome to WebmasterWorld Guest from 54.198.134.104
Forum Moderators: not2easy
The parent list has position:relative; so i can use position:absolute; on the nested list to put it correctly underneath.
Im wanting the sub list to be positioned exactly one pixel from the left of the parent list container, but in IE its positioning it exactly one pixel to the left of the padding on the list. Op + FF are behaving as expected.
Any thoughts?
HTML4 strict full DTD
Cheers
Ben
As for the fix, adjust the top/left (or whatever you're using to specify the location of the absolutely positioned element) to compensate for the padding of the containing element. For example, if your containing element has a padding of 10px, then adjust the top/left to be -10px.
I haven't verified that will work, but I think it should. You may also need to adjust the z-index to make sure your absolutely positioned element is on top.
I had considered C comments and the negative position fix, but was wondering if anyone knew of the reason for this strange problem, as its one i havent come across before.
If possible id like to stay as hack/workaround free as possible, but thats looking increasingly unlikely :(
<ul>
<li><a href="#">Tab 1</a>
<ul>
<li>Sub item 1</li>
<li>Sub item 2</li>
</ul>
</li>
</ul>
If you apply padding to the top level Tab 1, then I think it makes sense that everything contained within that list is going to be within that padding.
Therefore, maybe you should remove the padding from the <li> and instead apply it to <a>? Or you could wrap "Tab 1" in a span and apply it to that. Just an idea.
Im wanting the sub list to be positioned exactly one pixel from the left of the parent list container, but in IE its positioning it exactly one pixel to the left of the padding on the list. Op + FF are behaving as expected.
This may have something to do with how different browsers handle clearing marker-box space for lists. Moz uses padding, IE uses margin. So depending on how you've handled those two properties on the list elements, this could be the source of the discrepancy.
For instance, if you've set a padding but not a margin (and the margin hasn't been zeroed out), then IE is going to add it's default list margin (the marker box) into the mix while FF won't (the explicit padding will override FF's default padding used for marker-box space).
If you haven't already, I would check that you've negated all default margin and padding on the lists, then explicitly set one or the other and see how it looks.
cEM