rickl
11-04-2007, 06:17 PM
This is probably an easy question for you CSS experts...
I have a logo positioned absolutely in the top left, and it works perfectly fine in Firefox, but in IE it disappears.
I've isolated the issue and the culprit is the float:left; on the #nav <ul>, but I need to float that in order to contain the floated <li> elements.
Here's my markup:
<div id="masthead">
<div id="logo">
<img src="/x.gif" alt="logo" />
</div>
<div id="beta">
<img src="/x2.gif" alt="beta icon" />
</div>
<ul id="nav">
<li id="t-lorem1" class="last"><a href="/lorem1">Lorem1</a></li>
<li id="t-lorem2"><a href="/lorem2">Lorem2</a></li>
</ul><!-- #nav -->
</div><!-- #masthead -->
And my CSS:
#logo {
position: absolute;
left: 20px;
top: 15px;
}
#beta{
position: absolute;
left: 400px;
top: 10px;
}
#nav {
float: left; /* makes logo disappear */
width: 100%;
margin: 0;
padding: 80px 0px 0 0px;
list-style: none;
background: #fbf0e6 url(public/images/x.gif) repeat-x bottom left;
}
#nav li {
float: right;
margin: 0;
padding: 0;
}
#nav .last {
margin-right: 30px;
}
div#masthead:after {
content: ".";
height: 0;
visibility: hidden;
display: block;
clear: both;
}
div#masthead {
position: relative;
}
So I know what's causing it, but I don't know why, and I don't know exactly what I should do to fix this. I would really appreciate any tips!
Thank you.
Rick
I have a logo positioned absolutely in the top left, and it works perfectly fine in Firefox, but in IE it disappears.
I've isolated the issue and the culprit is the float:left; on the #nav <ul>, but I need to float that in order to contain the floated <li> elements.
Here's my markup:
<div id="masthead">
<div id="logo">
<img src="/x.gif" alt="logo" />
</div>
<div id="beta">
<img src="/x2.gif" alt="beta icon" />
</div>
<ul id="nav">
<li id="t-lorem1" class="last"><a href="/lorem1">Lorem1</a></li>
<li id="t-lorem2"><a href="/lorem2">Lorem2</a></li>
</ul><!-- #nav -->
</div><!-- #masthead -->
And my CSS:
#logo {
position: absolute;
left: 20px;
top: 15px;
}
#beta{
position: absolute;
left: 400px;
top: 10px;
}
#nav {
float: left; /* makes logo disappear */
width: 100%;
margin: 0;
padding: 80px 0px 0 0px;
list-style: none;
background: #fbf0e6 url(public/images/x.gif) repeat-x bottom left;
}
#nav li {
float: right;
margin: 0;
padding: 0;
}
#nav .last {
margin-right: 30px;
}
div#masthead:after {
content: ".";
height: 0;
visibility: hidden;
display: block;
clear: both;
}
div#masthead {
position: relative;
}
So I know what's causing it, but I don't know why, and I don't know exactly what I should do to fix this. I would really appreciate any tips!
Thank you.
Rick