Although not that widely supported, I have found a way to make 100% height with CSS work in IE, Firefox and Opera. Three of the most major browsers right now. Today, I show you how to accomplish this fun little trick. First we must look at the html and body tags. In CSS’ eyes, these tags are block level elements. Meaning by default that they have a value of auto height and width. Changing these values in your CSS, you can quickly add 100% height to your design.
Here’s the code:
html, body {height: 100%;}
And there you have it. Wasn’t that easy? Now any time you add an element within your page, you can give it a value of a 100% height using CSS! If your still a little confused, thats ok. I wrote a quick page for you to use as a way of learning.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Call me Jack | 100% Height with CSS</title>
<style>
html, body {margin: 0; padding: 0;}
html, body, div {height: 100%;}
div {width: 50%; background-color: green; margin: 0px auto 0px; text-align: center; padding: 20px;}
</style>
</head>
<body>
<div><a href="http://callmejack.wordpress.com" target="_blank">Call me Jack</a></div>
</body>
</html>

3 comments
Comments feed for this article
November 17, 2006 at 10:36 am
Gerhard
Tx a lot man, u have no idea… im on a project now that I need that to work, FF usually acts up with this who would have thought 100% the body and html tags too
Tx
November 25, 2006 at 8:44 pm
Jack
Hey Gerhard,
Glad you found the post useful.
January 11, 2007 at 5:46 pm
Michael Müller C. | Diseño y Desarrollo Web, Estándares, CSS, HTML y más! | Guayaquil, Ecuador | Web Design Blog » 100% Height with CSS
[...] un interesante artículo que nos muestra como lograr alturas del 100% en un contenedor/página utilizando CSS. Although not [...]