473,397 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

IE: Div with height of window

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
3 1984
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Paul | last post by:
Hi, I'm wondering if someone out there can help me overcome this quandary. I need to be able to calculate the height of the current page. I need to calculate the height of the page in pixels after...
6
by: Jason Bassford | last post by:
Okay, What I'm trying to do is create two boxes, one on top of the other. The first is a static height, the 2nd, underneath it, should take up the remaining amount of screen space and overflow...
5
by: Secret Guy | last post by:
Because of my experience posting various places over the last couple of weeks: I'm expecting to be greated with hostility for asking about concepts instead of "practical" things, since that has...
12
by: Kepler | last post by:
How do you get the height of the client browser in IE? Both document.body.clientHeight and document.body.offsetHeight return the height of the document. If the page is long and there's a vertical...
2
by: Animanera | last post by:
Hi to all. Is there a way that I can obtain the WINDOW INNER HEIGHT via JS (need only for Internet Explorer 6)? But please give attention to the words INNER and WINDOW. In particular, INNER...
1
by: Rune Jacobsen | last post by:
Hi all, I have an application with one particular form that lists a number of items in a listview. In addition to the listview, there is a panel on top with some simple controls to go back and...
4
by: reycri | last post by:
I have a page that works as I intend in IE but not in Firefox: <html> <head> <title>Overflow Test</title> </head> <body style='overflow:hidden; margin:0; padding:0;'> <table border='0'...
1
by: soms2m | last post by:
HELLO ALL, I want to fill the parent window height with respect to the sub window height which is loading using ajax (mootools). For example if the parent window height is normal and the loading...
2
by: laszlokenez | last post by:
Tested in IE7 and FF2. I have 2 frames, 2 similar tables in them, similar CSS. (I have 1px cellpadding, and 1px border aroud the cells. From one frame I read the offsetHeight of a cell...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.