Just an FYI, a percentage based height or width is ALWAYS computed based on
the containing parent's height or width (respectively).  So a height:5% is
5% of whatever the parent is.


Try this.


test1.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
html, body{
  height: 100%;
}
body{
  background-color: #ffffff;
  color: blue;
  font-size: 1.2em;
}
#sidecontent{
  height: 50%;
  border: thin solid red;
}
</style>
</head>


<body>
<div id="sidecontent">
<a href="" 1</a>
<a href="" 2</a>
<a href="" 3</a>
</div>
</body>
</html>


Notice that the height of sidecontent stays right around the stuff it
contains.  However if you add in html, body{height:100%;} at the top of the
styles, then notice the difference.  The reason that you need to use html,
body is that different browsers will use html or body respectively as the
containing parent.

<cf_shamelessplug>
This and many more snippets of valuable information are available in the 4
day  Hands on Training Class I am giving in October here in Maryland. I am
also available for corporate training for this course.
http://www.teratech.com/training/oc_classes.cfm#css
</cf_shamelessplug>


Sandy Clark

  _____  

From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 17, 2004 6:33 PM
To: CF-Community
Subject: RE: How many people don't post their sites?

For a good while (maybe erroneously) the lack of %-height
specification in either html or css was one of my biggest pet peeves.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to