Hi.
I want a very simple drop-down navbar, but not knowing JavaScript I was hoping to do it with CSS.
But here’s the rub, although I can certainly find plenty of CSS drop-down menus on the web I desperately need to keep it simple as still I’m still learning I want to understand just how it works, then build on it. Just downloading one won’t help me. When I can use one that I can understand I can then build on it (transforms/transitions etc…). The ones I have downloaded, when I took a look at the code they are so very complicated, no help at all to assist me in my understanding of CSS.
I have come-up with a very simple one but although it works fine in all modern browsers, including IE8…
1). In IE7 the curser doesn’t change into a hand but remains a pointer. Also the outer box doesn’t wrap around the inner three.
2). In IE6, the same as IE7 plus…well it just doesn’t work at all.
3). Using the iPhone Simulator (Mac). it looks fine with the outer box wrapping around the inner, but it doesn’t recognise it as a button at all.
Here’s my simple code…
<!DOCTYPE HTML>
<html>
<head>
<title></title>
</head>
<style>
div.box {
height: 50px;
background-color: red;
width: 200px;
margin: 5px;
text-align: center;}
div#box {
height: 60px;
overflow: hidden;
border: 1px solid gray;
display: inline-block}
div#box:hover {
height: 170px;}
div.box:hover {
background-color: green;}
</style>
<body>
<div id="box">
<a href=""><div class="box">One</div></a>
<a href=""><div class="box">Two</div></a>
<a href=""><div class="box">Three</div></a>
</div>
</body></html>
I know I can target IE7 and IE6 with conditional comments and the iPhone with a media query but what to do to fix them…that I don’t know.
Maybe I’m approaching this completely wrong, if so please steer me in the right direction. Any help appreciated only…if possible keep it simple. Although I really want a drop a down menu, that is only half the story…I really need to understand it to.
Regards, Karl.