I would have thought it would be as easy as setting width / height to 100%, but this only affected the width. I tried setting width and height of the body element to 100%, too, but without change.

If I set the height for body to a fixed number of pixels, it works (the div then stretches to that height).

I'm looking at this in Firefox 3.5, if that matters.

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Demo</title>
    <style type="text/css">
        body {
            width: 100%;
            height: 100%;
            padding: 0 0 0 0;
            margin: 0 0 0 0;
            /* this is to make the box visible */
            border: 1px solid blue;
        }
        #flexAppLayout {
            margin: auto;
            padding: 0 0 0 0;
            width: 100%;
            height: 100%;
            /* this is to make the box visible */
            border: 1px solid red;
        }
    </style>
</head>
<body>
    <div id="flexAppLayout">
        <!-- contains a Flex app (object tag with SWF movie), omitted for brevity -->
    </div>
</body>
</html>

2 answers

KC Rajput 178
3
points
This was chosen as the best answer

try this

 body, html {
            width: 100%;
            height: 100%;
            padding: 0 0 0 0;
            margin: 0 0 0 0;
            /* this is to make the box visible */
            border: 1px solid blue;
        }

add this in css.

Answered over 6 years ago by KC Rajput
1
point

Set body to 100% height and then your div will know what 100% is. but be warned it doesn't dynamically resize.

Answered over 6 years ago by Tony Crockford
  • Tried that already, didn't help. Hanno Fietz over 6 years ago
  • then we need to see code. Tony Crockford over 6 years ago
  • Added some. Hanno Fietz over 6 years ago
  • ah, yes, html and body need 100% height, sorry Tony Crockford over 6 years ago