• 0

Stupid CSS question


Question

Just started out working on a new design and having some early trouble. I haven't messed with this stuff in a while.

Anyway, I'm trying to make this column, which will be a menu stretch to the bottom of the page. Obviously height:100% doesn't work or I wouldn't be asking. Any help greatly appreciated. Here's the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>TEST</title>
<style type="text/css">
	body {
  background:#444444;
  }
	#right {
  float:right;
  width:125px;
  background:#606060;
  border:1px solid #999999;
  padding:5px;
  text-align:center;
  }
</style>
</head>
<body>
<div id="right">

<pre>
s-e

blah
blah
blah
</pre>

</div>
</body>
</html>

Thanks.

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Unfortunately there isn't any way to do that with current HTML standards. The best thing you can do is to make it a certain length (say 550px) so that it will fill up most of the screen even if the inner contents don't, and it will automatically resize if it needs more space to fit eveything in.

Link to comment
Share on other sites

  • 0
<style type='text/css'>
body {
	margin: 0px;
	padding: 0px;
}

.menu {
	height: 100%;
	width: 125px;
	background: #DDDDDD;
}
</style>

<body>

<div class='menu'>
	Hello!
</div>

</body>

Link to comment
Share on other sites

  • 0

I stand corrected... I looked through the w3c site and tested it out myself. Aparently they made some changes (or browsers fixed their bugs) and now pretty much every element can have percentile attributes. Now I'm not even sure why you ever asked this; your code does work with height:100%;

Link to comment
Share on other sites

  • 0

all right, all i needed to do was change #right to .right and id to class.

i had never even seen a # before today in css. i should just do things from scratch instead of using css sample pages. i ended up using frames anyway because of the rest of the sites fuction. bleh.

thanks a ton for the help though. :) i'm sure to have some more questions tomorrow.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.