I am just getting started with css and can't figure out what's going on with this simple positioning example.
<code>
<html>
<head>
<style>
div.sidebar {position:absolute; background-color:cornflowerblue; top:50; left:50; width:200px; height: 75%; padding-left: 6px; padding-right:4px; padding-top: 6px; font-size:16pt;}
div.maintext {position:absolute; background-color:blue; top:50px; left: 255px; height: 75%; width: 75%;}
img.relative {position:relative; left=30%; top=20% }
div.mytest {position:absolute; background-color:cornflowerblue; top:50; left:50; width:200px;
height: 75%; padding-left: 6px; padding-right:4px; padding-top: 6px; font-size:16pt;}
</style>
</head>
<body>
<div class="sidebar"> HERE is a sidebar. You can fill it with links, text, whatever...</div>
<div class="maintext"> <img class="relative" height="400" width="475" src="house.jpg"></div
<div style="position:absolute;background-color:green; top:100px; left:100px;"> DIV green </div>
<div style="position:absolute;background-color:red; top:500px; left:100px;"> DIV red </div>
</body>
</html>
</code>
When i pull this up in firefox or IE the div with "DIV green" has no styles applied and the div "DIV red" does. However, if I reverse the order of these two divs the "DIV green" works and the "DIV red" does not. Why does the order matter in this case? Why don't they both work no matter what order they are in?
thanks for any help
<code>
<html>
<head>
<style>
div.sidebar {position:absolute; background-color:cornflowerblue; top:50; left:50; width:200px; height: 75%; padding-left: 6px; padding-right:4px; padding-top: 6px; font-size:16pt;}
div.maintext {position:absolute; background-color:blue; top:50px; left: 255px; height: 75%; width: 75%;}
img.relative {position:relative; left=30%; top=20% }
div.mytest {position:absolute; background-color:cornflowerblue; top:50; left:50; width:200px;
height: 75%; padding-left: 6px; padding-right:4px; padding-top: 6px; font-size:16pt;}
</style>
</head>
<body>
<div class="sidebar"> HERE is a sidebar. You can fill it with links, text, whatever...</div>
<div class="maintext"> <img class="relative" height="400" width="475" src="house.jpg"></div
<div style="position:absolute;background-color:green; top:100px; left:100px;"> DIV green </div>
<div style="position:absolute;background-color:red; top:500px; left:100px;"> DIV red </div>
</body>
</html>
</code>
When i pull this up in firefox or IE the div with "DIV green" has no styles applied and the div "DIV red" does. However, if I reverse the order of these two divs the "DIV green" works and the "DIV red" does not. Why does the order matter in this case? Why don't they both work no matter what order they are in?
thanks for any help