www.webdeveloper.com
Results 1 to 2 of 2

Thread: CSS Drop-Down Menu Help

Hybrid View

  1. #1
    Join Date
    Jun 2010
    Location
    Illinois, USA
    Posts
    7

    CSS Drop-Down Menu Help

    I know this example is horizontal so far. But I intend to convert it to a horizontal once the vertical is complete. The problem is that I have menu items 3 levels deep. With the current code, when the user hovers over a menu item with sub-items, all subsequent levels appear. I'm trying to ensure maximum browser compatibility. And I'm also trying to minimize the need to use classes on every line.

    HTML:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!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>
    <meta http-equiv="Content-Type" content="application/xhtml+xml" />
    <title>Navigation Testing</title>
    <link rel="stylesheet" type="text/css" href="normalize.v2.1.0.css" />
    <link rel="stylesheet" type="text/css" href="nav.css" />
    </head>
    <body>
    <div id="webpage">
    <div id="header">
    <h1>Navigation Testing</h1>
    </div>
    <div id="vnav">
    	<ul>
    		<li><a href="#">Home</a></li>
    		<li><a href="#">Tutorials</a>
    			<ul>
    				<li><a href="#">Photoshop</a></li>
    				<li><a href="#">Illustrator</a></li>
    				<li><a href="#">Dreamweaver</a>
    					<ul>
    						<li><a href="#">HTML</a></li>
    						<li><a href="#">CSS</a></li>
    					</ul>
    				</li>
    			</ul>
    		</li>
    		<li><a href="#">Articles</a>
    			<ul>
    				<li><a href="#">Web Design</a></li>
    				<li><a href="#">User Experience</a></li>
    			</ul>
    		</li>
    		<li><a href="#">Inspiration</a></li>
    	</ul>
    </div>
    <div id="main">
    <p>This is the main body of the page.</p>
    </div>
    <div id="footer">
    </div>
    </div>
    </body>
    </html>
    CSS:
    Code:
    @charset "utf-8";
    /* CSS Document */
    
    ol, ul {
    	list-style-type:none;
    }
    
    a {
    	text-decoration: none;
    }
    
    #vnav li {
    	display: block;
    	border: solid 1px #000000;
    	padding-top: 4px;
    	padding-left: 4px;
    	width: 80px;
    	height: 20px;
    	margin-bottom: -1px;
    }
    
    #vnav a {
    	display: block;
    	color: #006600;
    }
    
    #vnav a:hover {
    	color: #009900;
    }
    
    #vnav ul li:hover {
    	position: relative;
    	background-color: #eeeeee;
    }
    
    #vnav ul li ul, #vnav ul li ul li ul {
    	position: absolute;
    	display: none;
    	padding-left: 4px;
    }
    
    #vnav ul li ul li {
    	width: 150px;
    }
    
    #vnav ul li:hover ul {
    	display: block;
    	left: 80px;
    }
    Thank you for any and all constructive input!

  2. #2
    Join Date
    Jun 2010
    Location
    Illinois, USA
    Posts
    7
    I found a good video tutorial on youtube by one Ralph Phillips that shows the drop-down plus fly-out technique, basically supporting a three-level menu. I believe it will scale very easily to as many sub-levels as anyone may require. The link is here: http://www.youtube.com/watch?v=TmQm-p3wCSU

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles