Can anyone tell me what I did wrong?
Hi Mike, Welcome to the forums 
You have placed position:relative; on the wrong div, it belongs on the .banner div.
AP elements always position themselves from the nearest positioned ancestor, by using position:relative; on the div you want to position from you will establish the containing block.
You should also be able to loose that 100% wide float on the .banner-wrap and just let it be a static block with a default width of 100%.
Looks like the hotspots have unique positions so I would opt for an ID on those.
Try this -
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Test Page</title>
<style type="text/css">
body {
margin:0;
padding:0;
}
.banner-wrap {
/*width:100%;*/
height:388px;
/*float:left;*/
/*position:relative;*/
background-repeat: repeat-x;
}
.banner {
width:970px;
margin:0 auto;
position:relative;
height:388px;
background:red url(images/banner.jpg) no-repeat 50% 0;
}
#hotspot1 {
width: 90px;
height: 90px;
position: absolute;
top: 30px;
left: 30px;
background:lime;
}
#hotspot2 {
width: 90px;
height: 90px;
position: absolute;
top: 90px;
left: 230px;
background:yellow;
}
#hotspot3 {
width: 90px;
height: 90px;
position: absolute;
top: 150px;
left: 430px;
background:orange;
}
</style>
</head>
<body>
<div class="banner-wrap">
<div class="banner">
<a href="1.html" id="hotspot1">1</a>
<a href="2.html" id="hotspot2">2</a>
<a href="3.html" id="hotspot3">3</a>
</div>
</div>
</body>
</html>
Bookmarks