Hi all, I've just started learning CSS and HTML to develop websites as a hobby. I was experimenting with what I'm learning and have hit a block (excuse the pun). I'm trying to create a drop-down menu using CSS and HTML alone. In the following I try to assign what happens to div with class "dropdown" when a div with class"menu" is hovered over. Maybe I'm just making a newbie mistake, I don't know, but I'd really appreciate any help on this. Thanks! Here's the CSS:
body {
background-image: url(Pattern1.gif);
font-size: 12pt;
font-family: Caviar Dreams;
font-weight: inherit;
background-position: left center;
text-decoration: none;
background-attachment: scroll;
color: darkgreen;
z-index: -1;
padding-top:120px;
}
a:link {
text-decoration: none;
font-size: 14pt;
}
a.menu {
padding-right: 20px;
font-size: 90%;
-moz-transition:font-size .25s;
-webkit-transition:font-size .25s;
}
a.menu:hover {
font-size: 100%;
-moz-transition:font-size .25s;
-webkit-transition:font-size .25s;
}
a:active {
color: #686868;
text-decoration: none;
font-size: 14pt;
}
a:visited {
color: #993300;
text-decoration: none;
font-size: 14pt;
}
a:hover {
color: white;
text-decoration: none;
font-size: 14pt;
}
table {
background-image: url(menu.png);
z-index: -2;
width: 100%;
}
ul {
text-align: center;
font-size: 180%;
font-family: OptimusPrinceps;
line-height: 30pt;
margin-bottom:2px;
}
li {
display: inline;
}
h1 {
color: #5D9961;
line-height: 35px;
}
header {
position:fixed;
background-image:url(menu.png);
background-repeat:repeat;
margin-top:-142px;
margin-left:-8px;
width:100%;
z-index:1;
}
footer {
position:relative;
bottom:-1000px;
background-image:url(menu.png);
background-repeat:repeat-x;
margin-left:-8px;
width:100%;
}
p.copyright {
text-align:right;
font-size:100%;
font-family:OptimusPrinceps;
color:white;
}
div.menu {
height:35px;
width:80px;
padding-left:10px;
padding-right:12px;
padding-bottom:5px;
margin-left:-5px;
color:green;
margin-bottom:-20px;
display:inline;
}
div.menu a {
color:green;
}
div.menu:hover {
background:black;
opacity:.8;
}
div.menu:hover a{
color:grey;
}
div.dropdown {
position:absolute;
width:500px;
height:200px;
background:black;
margin-top:0px;
margin-left:275px;
display:none;
}
div.menu:hover div.dropdown{
display:block;
}
And here's the HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>thisisnotanid</title>
<link rel="stylesheet" type="text/css" href="style.css">
</link>
</head>
<body>
<header>
<h1>elegance</h1>
<ul>
<li><div class="menu"><a href="#">Item 1</a></div></li>
<li><div class="menu"><a href="#">Item 2</a></div></li>
<li><div class="menu"><a href="#">Item 3</a></div></li>
<li><div class="menu"><a href="#">Item 4</a></div></li>
<li><div class="menu"><a href="#">Item 5</a></div></li>
</ul>
<div class="dropdown">Hi</div>
</header>
<footer>
<p class="copyright">© Copyright 2011, Thisisnotanid.</p>
</footer>
</body>
</html>
If you need any further information, I would be happy to assist!