By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,041 Members | 1,793 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,041 IT Pros & Developers. It's quick & easy.

IE: Div with height of window

P: n/a
Dear Newsgroup,
I would like to have a DIV on my page which has the size of the page. In
Firefox
<body>
<div
style="position:absolute;top:0px;bottom:0px;width: 100%;background-color:red;">
text
</div>
</body>

as well as

<body>
<div style="position:absolute;height:100%;width:100%;ba ckground-color:red;">
text
</div>
</body>

works.

In Internet Explorer none of both works - the height is always only the
height of the text.

How can I make it work in all browsers?

Thanks for help,
Martin
Sep 16 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
VK

Martin Plotz wrote:
I would like to have a DIV on my page which has the size of the page.
The container representing available viewport in the window is called
"html"

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
html { background-color: #FF0000}
</style>
</head>
<body>
</body>
</html>

Now define properties of body and any nested containers inside the body.

Sep 16 '06 #2

P: n/a
Martin Plotz wrote:
Dear Newsgroup,
I would like to have a DIV on my page which has the size of the page. In
Firefox
<body>
<div
style="position:absolute;top:0px;bottom:0px;width: 100%;background-color:red;">
text
</div>
</body>

as well as

<body>
<div style="position:absolute;height:100%;width:100%;ba ckground-color:red;">
text
</div>
</body>

works.

In Internet Explorer none of both works - the height is always only the
height of the text.
Add rule height:100% on body selector.

Louise
Sep 16 '06 #3

P: n/a
Thanks to both of you. That answered one question - but I thought I
could solve my "real" problem then. I am afraid it didn't - see my other
posting...
Martin
Sep 16 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.