May be a FAQ but I haven't found a suitable solution yet. The
general (presentational ) structure of a document I'm describing is:
Header
-------
Content
-------
Footer
I want to make the "Content" part to fill the available height of
the viewport if its content has smaller height. I've been trying
some variants and the last one looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Fill height</title>
<style media="screen" type="text/css">
html { height: 100% }
body { margin: 0; padding: 0; min-height: 100%;
/*position: relative; border: 1px dashed*/ }
</style>
</head>
<body>
<div style="position : absolute">Heade r</div>
<div style="margin: 3em 0">Content<b r>
<br><br><br><br ><br><br>...</div>
<div style="position : absolute; bottom: 0">Footer</div>
</body>
</html>
I don't know why but Opera and Mozilla/Netscape behave really
strange. Adding 'position: relative' to the body declaration seems
to fix it in Opera (to some extent)... but this should be in anyway.
Adding a border to the body "fixes" it in Mozilla/Netscape too but
there appears a scroll bar, because of that additional border.
Has someone achieved something similar? I would appreciate any comments.
--
Stanimir
general (presentational ) structure of a document I'm describing is:
Header
-------
Content
-------
Footer
I want to make the "Content" part to fill the available height of
the viewport if its content has smaller height. I've been trying
some variants and the last one looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=US-ASCII">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>Fill height</title>
<style media="screen" type="text/css">
html { height: 100% }
body { margin: 0; padding: 0; min-height: 100%;
/*position: relative; border: 1px dashed*/ }
</style>
</head>
<body>
<div style="position : absolute">Heade r</div>
<div style="margin: 3em 0">Content<b r>
<br><br><br><br ><br><br>...</div>
<div style="position : absolute; bottom: 0">Footer</div>
</body>
</html>
I don't know why but Opera and Mozilla/Netscape behave really
strange. Adding 'position: relative' to the body declaration seems
to fix it in Opera (to some extent)... but this should be in anyway.
Adding a border to the body "fixes" it in Mozilla/Netscape too but
there appears a scroll bar, because of that additional border.
Has someone achieved something similar? I would appreciate any comments.
--
Stanimir
Comment