How can I make the #top div in this example properly overlay the #bottom div? At the moment, when I mouseover the box #top, the hover effect is only shown if your mouse enters the div without touching content of #bottom. You can prove this by mousing over from the bottom (no text, so it works) and then mousing over from the right (where you touch the text, and it doesn’t work).
What is the solution to make the #top overlay #bottom?
Thanks for any tips!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<style type="text/css">
body
{
padding: 0;
margin: 0;
}
#bottom
{
padding: 0;
margin: 0;
position: relative;
width: 100px;
height: 60px;
background: red;
z-index: auto;
}
#top
{
width: 100px;
height: 60px;
position: absolute;
top: 0;
left: 0;
z-index: 20;
}
#top:hover
{
background: green;
}
</style>
</head>
<body>
<div id="bottom">I am the bottom div</div>
<div id="top"></div>
</body>
</html>