Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jul 2008
    Posts
    71
    Thanks
    7
    Thanked 3 Times in 3 Posts

    css list navigation problems

    I can't figure this out...

    I'm trying to make a navigation with lists, but i cant get it to display correctly.

    The nav bar looks the way i WANT it to look in FF, but in IE it looks the way i EXPECTED it to look with the code. and expression web doesn't look like either (so, I'm constantly previewing).

    The main problem is that the divs in FF are overlapping and i can't figure out why, HELP?

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>ch4sethe5un</title>
    
    <style type="text/css">
    html, body{
    	margin:0;
    	padding:0;
    }
    #navcontainer{
    	width: 800px;
    	height: 30px;
    }
    #navcontainer ul
    {
    padding-left: 0;
    margin-left: 0;
    background-color:#000;
    float: left;
    font-family: arial, helvetica, sans-serif;
    }
    
    #navcontainer ul li { display: inline; }
    
    #navcontainer ul li a
    {
    	color: White;
    	text-decoration: none;
    	float: left;
    	text-align: center;
    	width: 160px;
    	height: 30px;
    	padding-top: 5px;
    }
    #navcontainer ul li a:hover
    {
    	background-color: #0066CC;
    	color: #fff;
    	height: 30px;
    }
    #dirHeader{
    	background-color: #0099CC;
    	height: 30px;
    	width: 800px;
    }
    </style>
    
    </head>
    
    
    <body>
    <div id="wrapper">
    	<div id="navcontainer">
    		<ul id="navlist">
    			<li><a href="#">Item one</a></li>
    			<li><a href="#">Item two</a></li>
    			<li><a href="#">Item three</a></li>
    			<li><a href="#">Item four</a></li>
    			<li><a href="#">Item five</a></li>
    		</ul>
    	</div>
    	<div id="dirHeader">
    	</div>
    </div>
    
    </body>
    
    </html>

  • #2
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Hi,

    I found in ff that it was completely horizontal but that in IE 6, item 5 was on a new line until hover, when it all wnet onto the one line.

    Try
    Code:
    * {
    padding:0;
    margin : 0;
    border:0;
    }
    instead of
    Code:
    html, body{
    	margin:0;
    	padding:0;
    }
    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #3
    New Coder
    Join Date
    Jul 2008
    Posts
    71
    Thanks
    7
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by bazz View Post
    Hi,
    I found in ff that it was completely horizontal but that in IE 6, item 5 was on a new line until hover, when it all wnet onto the one line.
    Thank you, that fixed it a little bit (less severe overlap), but in FF the first div is still overlapping the second ~5px.

    Also could you explain what you typed in the quote earlier, i don't quite understand it?

  • #4
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Yup, I used the universal selector '*' wiht the attributes inside the {}. That means that everything in the page is assigned the value of 0 to border, padding and margin.

    I'll look again at the divs and see, if by adding a background color, I can see what you mean. It looks fine, to me in FF3 and IE6.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • Users who have thanked bazz for this post:

    ch4sethe5un (07-17-2008)

  • #5
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Yeh I found the cause of the overlap.

    Code:
    #navcontainer ul li a
    {
    	color: White;
    	text-decoration: none;
    	float: left;
    	text-align: center;
    	width: 160px;
    	height: 30px;
    	padding-top: 5px;
    }
    Your nav_container is assigned 30px of height.
    The total height of the a link, is 35px, wich means it displays lower than the bottom edge of the div. And by displaying lower than the bottom of the div, it hides the top 5px of the next div.

    solution: either add 5px to your nav_container or remove the 5px padding from the link OR add a margin-top:5px to the dirHeader div.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • Users who have thanked bazz for this post:

    ch4sethe5un (07-17-2008)

  • #6
    New Coder
    Join Date
    Jul 2008
    Posts
    71
    Thanks
    7
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by bazz View Post
    Yeh I found the cause of the overlap.

    Your nav_container is assigned 30px of height.
    The total height of the a link, is 35px, wich means it displays lower than the bottom edge of the div. And by displaying lower than the bottom of the div, it hides the top 5px of the next div.

    solution: either add 5px to your nav_container or remove the 5px padding from the link OR add a margin-top:5px to the dirHeader div.

    bazz
    Thanks for the help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •