Forum Moderators: not2easy

Message Too Old, No Replies

Baffled by list behaviour in IE 6

         

jstam

1:35 am on May 10, 2005 (gmt 0)

10+ Year Member



Hello, I'm trying to create a navigation bar with a styled list, but am having great difficulty understanding its behaviour in IE6.

In IE, there are gaps that appear in between the list items, which I don't think should happen given the CSS I've written. The gaps don't occur in Mozilla Firefox. I have put the various borders and background colors in for debugging purposes.

Even more strangely, when I set the border in the li (border: 0px solid green;) to anything other than 0px, the gaps disappear!

Could someone try saving my code and running it in the two browsers? I have absolutely no idea what's going on.

Thank you very much

My code is below:

<html>
<head>
<style>
.sidebar2 {
font-family: Arial;
font-size: 11pt;
font-weight: bold;
background-color:pink;
width:175px;
}

.sidebar2 ul {
border: 1px solid blue;
list-style-type: none;
margin: 0;
padding: 0;
width:175px;
}

.sidebar2 li {
padding: 0px;
margin: 0px;
background-color: yellow;
border: 0px solid green;
}

.sidebar2 a {
display: block;
color: #000000;
background-color: #FFFFFF;
padding-top: 4px;
padding-right: 8px;
padding-bottom:4px;
padding-left: 2px;
margin:0px;
border: 1px solid black;
}
</style>
</head>
<body>

<div class="sidebar2">
<ul>
<li><a href="asdf">Header</a></li>
<li><a href="asdf">Link 1</a></li>
<li><a href="fdsa">Link 2</a></li>
<li><a href="fdsa">Link 2</a></li>
<li><a href="fdsa">Link 2</a></li>
<li><a href="asdf">Link 1</a></li>
</ul>
</div>

</body>
</html>

Ohioian

1:49 am on May 10, 2005 (gmt 0)

10+ Year Member



Disregard this post and read the next message I messed this one all up! It will work with Firefox as well!

[edited by: Ohioian at 1:58 am (utc) on May 10, 2005]

Ohioian

1:55 am on May 10, 2005 (gmt 0)

10+ Year Member



I'm sorry I hit submit instead of preview and it came out all wrong.

<ul><li><a href="asdf">Header</a></li><li><a
href="asdf">Link 1</a></li><li><a
href="fdsa">Link 2</a></li><li><a
href="fdsa">Link 2</a></li><li><a
href="fdsa">Link 2</a></li><li><a
href="asdf">Link 1</a></li></ul>

There that looks more like what I wanted to convey!

jstam

2:07 am on May 10, 2005 (gmt 0)

10+ Year Member



Thank you so much! I had spent like 3 hours looking at my CSS, even though it was all in the HTML! (I probably would have never thought to try joining the <li>s together too...)

createErrorMsg

10:33 am on May 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In IE, there are gaps that appear in between the list items,

This is the IE Whitespace in Lists Bug.

While removing the carriage return from between the list items in the source is one solution, it also renders the code virtually unreadable by human eyes.

A better solution (IMO) is cure the bug with a display:inline on the list items...

.sidebar2 li {
display:inline;
padding: 0px;
margin: 0px;
background-color: yellow;
border: 0px solid green;
}

cEM

Ohioian

11:23 am on May 10, 2005 (gmt 0)

10+ Year Member



display: inline; is good!

I had a similiar problem where I removed the surrounding block border to just a bottom line and things went awry when I just opened the page with the associated link... Read here:
[webmasterworld.com...]