Little Web Hut

Drop Down Menu - HTML and CSS code


Video Tutorial - Step by Step Creation Process

Simple Web Page CSS Drop Down Menu - Part 1
Simple Web Page CSS Drop Down Menu - Part 2



The HTML & CSS 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>
<title>HTML Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
.nav ul {list-style:none; margin:0; padding:0}
.nav li {float:left; width:100px; background-color:#444444; text-align:center;
         border-right:1px solid white; position:relative;
         height:30px; line-height:30px;}
.nav li ul li {float:none; width:150px; text-align:left; padding-left:5px;
         border-top:1px solid white;}
.nav a {text-decoration:none; color:white;}
.nav li ul {position:absolute; top:30px; left:0; visibility:hidden;}
.nav li:hover ul {visibility:visible;}

.nav li:hover {background-color:maroon;}

.content {clear:both;}
</style>
</head>

<body>
<h1>Heading Section</h1>

<div class="nav">
 <ul>

  <li>
   <a href="home.html">Home</a>
  </li>

  <li>
   <a href="photos.html">Photos</a>
   <ul>
    <li><a href="zoo.html">Zoo</a></li>
    <li><a href="lake.html">At the Lake</a></li>
    <li><a href="sunset.html">Sunset</a></li>
   </ul>
  </li>

  <li>
   <a href="contact.html">Contact</a>
  </li>

 </ul>
</div>

<h2 class="content">This is the content section.</h2>
</body>
</html>