Results 1 to 4 of 4

Thread: CSS Multi-Level Horizontal nav menu

  1. #1
    Join Date
    Nov 2008
    Location
    Atlanta, GA
    Posts
    15
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default CSS Multi-Level Horizontal nav menu

    I've been trying to build on my knowledge of CSS.

    So this week I created a basic CSS Tabs menu -- with a some help from the bright folks that use this forum.

    So now I'm trying my hand at a Multi-level menu. I found an example to attempt and study the example and tried to reproduce it.

    It nearly works except for one small, but important issue -- I cannot get the secondary menu to line up horizontally.

    I've learned alot from walking through this and re-reading parts of the books I have on CSS.

    Here's what I thought that would be the best solution:

    I've tried adding a "float: left" tag in the secondary navlist "li" list in the stylesheet.

    I've attached the stylesheet and the HTML code is below. The stylesheet has some comments that gives the link to the actual example I reviewed.

    So, now I'm looking for an experienced voice to chime in.

    What am I missing?

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Horizontal in a Horizontal Menu Example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css" media="all">@import url("hih_navtabs.css"); </style>
    </head>
    
    <body>
    <div id="navcontainer">
    	<ul id="navlist">
    		
        <li id="active"><a href="#" id="current">Item one</a> 
          <ul id="subnavlist">
            <li id="subactive"><a href="#" id="subcurrent">Subitem one</a></li>
            <li><a href="#">Subitem two</a></li>
            <li><a href="#">Subitem three</a></li>
            <li><a href="#">Subitem four</a></li>
          </ul>		
    		</li>
    		
        <li><a href="#">Item two</a></li>
    		
        <li><a href="#">Item three</a></li>
    		
        <li><a href="#">Item four</a></li>
    	</ul>
    </div>
    </body>
    </html>
    CSS: Attached
    Last edited by Snookerman; 04-22-2009 at 07:31 AM. Reason: added [html] tags and "Resolved" prefix

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Add this to your doctype:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    Also, you might have to change the height of your subnavlist:
    Code:
    #navlist ul#subnavlist {
    	position: absolute;
    	width: 100%;
    	left: 0;
    	top: 1.25em;
    	height: 0.8em;
    	margin: 0;
    	padding: 0;
    	border-bottom: 3px solid #f63;
    	white-space: nowrap;
    }

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    krisjohnson (11-10-2008)

  4. #3
    Join Date
    Nov 2008
    Location
    Atlanta, GA
    Posts
    15
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Default

    Snookerman:

    Wow! That did make a difference. Thanks!

    I'll need to review the Doctype section in my books
    It was only a small section in each one -- pretty powerful though.

    Ok -- now I can creat a version of my own and applied what I learned here

    Thanks again.

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Wink

    No problem, remember to add the Resolved prefix to this thread by editing your first post.

Bookmarks

Posting Permissions

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