Auke van Slooten wrote:
> So how do I tell the browser to display a 'fixed' div aligned with the
> bottom of the window, not the top-left (0,0) and which stays there, even
> when resizing the window?

What you do is you go to the documentation, 
http://www.w3.org/TR/REC-CSS2/ (although I find it more convinient to 
bookmark the page http://www.w3.org/TR/REC-CSS2/propidx.html) and you 
look up the property "position". On that page, where it is talking about 
position: fixed if tells you that the properties you want are top:, 
bottom: left: and right:

The key point is that bottom is measured from the bottom of the page. So 
you can do something like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Fixed positioning test</title>
<style type="text/css">
.top_bar {
   position: fixed;
   top: 0px;
   height: 100px;
   left: 0px;
   right: 0px;
   background-color: green;
}
.right_bar {
   position: fixed;
   top: 100px;
   bottom: 0px;
   left: 80%;
   right: 0%;
   background-color: blue;
}
.main {
   position: fixed;
   top: 100px;
   bottom: 0px;
   left: 0%;
   right: 20%;
   background-color: red;
}
</style>
</head>
<body>
<div class="top_bar">
  ...
</div>
<div class="right_bar">
  ...
</div>
<div class="main">
  ...
</div>
</body>
</html>

This works in Mozilla.

However, this does not work in IE6. Apparently MS have not yet 
implemented the position: fixed part of the standard! I guess that makes 
this of only theoretical interest for the time being.

Oh, and appologies for the slightly sarcastic tone of the first 
paragraph. I admit that reading W3C recommendations takes some practice, 
but it is a skill that it is worth some time to acquire since you then 
have the definative reference at your fingertips. but if you don't take 
the time to read the manuals first, then it is only fair that you put up 
with a bit of sracasm in return.

Tim.



Reply via email to