Forum Moderators: not2easy

Message Too Old, No Replies

ul navigation problem with IE

IE rendering problem using ul navigation

         

rdbat

1:49 am on Nov 12, 2009 (gmt 0)

10+ Year Member



Hello,

Pasted below is the code (css and html) I'm using for some navigation links at the top of a page. In most browsers it works fine, but for some reason in IE the last list item (sitemap) is disjointed from the inline style.

Instead of being tagged on at the end of the line (far right) it shows up on a separate line below the other list items. Is anyone familiar with this problem? (I have tested this in firefox (mac,win,linux), chrome (win), safari (mac),
opera (win, mac), and these all render fine. The problem seems to be in IE only. Any help would be appreciated.

<div class="nav1">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Mailing List</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Links</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>

/* nav1 */
.nav1 {width:350px; position:absolute; margin:5px 0 0 595px;}
.nav1 ul {float:right; padding:0 15px 0 0; font-weight:bold;}
.nav1 li {display:inline; list-style:none;}
.nav1 li a {display:block; float:left; padding:2px 5px 2px 5px; color: #ffcc00; text-decoration:none; font-size:100%;}
.nav1 a:hover {text-decoration:none; color: #ffcc00;}

D_Blackwell

2:17 am on Nov 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Taking the default margin: and padding: out will take care of IE.

ul, li {
margin: 0; padding: 0;
}

Opera is fine also, but you'll now need to deal with rendering variance in FF with sets .nav1 flush right.

D_Blackwell

2:26 am on Nov 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How about something like:

.nav1 {
width: 350px; position: absolute; /*margin: 5px 0 0 595px*/; top: 5px; right: 5%; right: 5%; border: .1em solid red;
}

The border is just added to help see what is going on.

The rendering of the code provided is consistent, but can't know how it will affect whatever else is on the page.

rdbat

4:47 am on Nov 12, 2009 (gmt 0)

10+ Year Member



Thanks for your reply. I tried inputing your sample code, but this did not resolve the disjointed list item. Essentially this relocated the whole ul section and the last item was still separated as before in IE

If margin and padding defaults are playing a role in this, do you think it could have anything to do with the defaults I'm using in the body element?

body {
margin: 0;
padding: 0;
background: #EDBE3C;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #333333;
}

D_Blackwell

7:19 am on Nov 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What version IE? Fine in IE 7 & 8 adding:

ul, li {
margin: 0; padding: 0;
}

If margin and padding defaults are playing a role in this, do you think it could have anything to do with the defaults I'm using in the body element?

No.
.....................
I stand corrected on the other hack:

Your markup is fine. I run vertical tabs in FF, so the container wasn't lining up because I didn't pull the slider bar over and was seeing about a 60px difference in position.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
ul, li {
margin: 0; padding: 0;
}
.nav1 {
width: 350px; position: absolute; /*margin: 5px 0 0 595px*/; top: 5px; right: 5%; right: 5%; border: .1em solid red;
}
.nav1 ul {
float: right; padding: 0 15px 0 0; font-weight: bold;
}
.nav1 li {
display: inline; list-style-type: none;
}
.nav1 li a {
display: block; float: left; padding: 2px 5px 2px 5px; color: #fc0; text-decoration:none; font-size:100%;
}
.nav1 a:hover {
text-decoration:none; color: #fc0;
}
</style>
</head>
<body>
<div class="nav1">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Mailing List</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Links</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>
<!--##########
Pasted below is the code (css and html) I'm using for some navigation links at the top of a page. In most browsers it works fine, but for some reason in IE the last list item (sitemap) is disjointed from the inline style.

Instead of being tagged on at the end of the line (far right) it shows up on a separate line below the other list items. Is anyone familiar with this problem? (I have tested this in firefox (mac,win,linux), chrome (win), safari (mac),
opera (win, mac), and these all render fine. The problem seems to be in IE only. Any help would be appreciated.
-->
</body>
</html>

D_Blackwell

7:20 am on Nov 12, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What version IE? Fine in IE 7 & 8 adding:

ul, li {
margin: 0; padding: 0;
}

If margin and padding defaults are playing a role in this, do you think it could have anything to do with the defaults I'm using in the body element?

No.
.....................
I stand corrected on the other hack:

Your markup is fine. I run vertical tabs in FF, so the container wasn't lining up because I didn't pull the slider bar over and was seeing about a 60px difference in position.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen">
ul, li {
margin: 0; padding: 0;
}
.nav1 {
width: 350px; position: absolute; /*margin: 5px 0 0 595px*/; top: 5px; right: 5%; right: 5%; border: .1em solid red;
}
.nav1 ul {
float: right; padding: 0 15px 0 0; font-weight: bold;
}
.nav1 li {
display: inline; list-style-type: none;
}
.nav1 li a {
display: block; float: left; padding: 2px 5px 2px 5px; color: #fc0; text-decoration:none; font-size:100%;
}
.nav1 a:hover {
text-decoration:none; color: #fc0;
}
</style>
</head>
<body>
<div class="nav1">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Mailing List</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#">Links</a></li>
<li><a href="#">Sitemap</a></li>
</ul>
</div>
<!--##########
Pasted below is the code (css and html) I'm using for some navigation links at the top of a page. In most browsers it works fine, but for some reason in IE the last list item (sitemap) is disjointed from the inline style.

Instead of being tagged on at the end of the line (far right) it shows up on a separate line below the other list items. Is anyone familiar with this problem? (I have tested this in firefox (mac,win,linux), chrome (win), safari (mac),
opera (win, mac), and these all render fine. The problem seems to be in IE only. Any help would be appreciated.
-->
</body>
</html>