sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Raghavendra's Avatar

height=100% is not working for Mozilla browser


Question posted by: Raghavendra (Guest) on October 18th, 2005 04:45 PM
Hi All,

Here is my code.
-------------------------------------------
<div style="height:100%">
<BODY>
sample text spanning about 30 lines
</BODY>
</div>
<table><tr><td>footer</td></tr></table>
-------------------------------------------

I am using this code to display the footer always at the end of the
browser window.

In IE the footer is getting displayed properly at the end even when the
text does not span the window height.

But in mozilla the footer is getting overlapped with the body text.

Any help will be appreciated.

Thanks,
Raghavendra.V

3 Answers Posted
Beauregard T. Shagnasty's Avatar
Beauregard T. Shagnasty October 18th, 2005 04:45 PM
Guest - n/a Posts
#2: Re: height=100% is not working for Mozilla browser

Raghavendra wrote:
[color=blue]
> Here is my code.
> -------------------------------------------
> <div style="height:100%">
> <BODY>
> sample text spanning about 30 lines
> </BODY>
> </div>
> <table><tr><td>footer</td></tr></table>
> -------------------------------------------[/color]

Your code is invalid and Mozilla is rightly rejecting it. IE, on the
other hand, attempts to guess, and frequently makes misteaks.

Please visit: http://validator.w3.org/

--
-bts
-When motorcycling, never follow a pig truck
Steve Pugh's Avatar
Guest - n/a Posts
#3: Re: height=100% is not working for Mozilla browser

Raghavendra wrote:[color=blue]
> <div style="height:100%">
> <BODY>
> sample text spanning about 30 lines
> </BODY>
> </div>
> <table><tr><td>footer</td></tr></table>[/color]

What on earth made you think that you can nest a body element inside a
div element? The above code so bogus that there is no correct way to
display it. Consider yourself lucky that browsers bother to display
anything at all.

And why do you think that your footer is tabular data?
[color=blue]
> I am using this code to display the footer always at the end of the
> browser window.[/color]

Where users with large windows won't notice it at all?
[color=blue]
> In IE the footer is getting displayed properly at the end even when the
> text does not span the window height.[/color]

IE does a lot of fixing up of broken code. In this case it just happens
to fix it up in such a way that matches what you want.
[color=blue]
> But in mozilla the footer is getting overlapped with the body text.[/color]

Interesting. I guess that you haven't bothered to show us all your
code.
[color=blue]
> Any help will be appreciated.[/color]

height: 100%; means 100% of the parent element's height. Your div
doesn't have a parent element, hence the height defaults to be being
the height of the content.

What you want isn't easy across browsers, mainly due to IE's terrible
CSS support but also due to the fact that the layour model in CSS
doesn't really work for this sort of thing (the relationship between
the window and the document has more nuances than most people think at
first).

I have an old example at http://steve.pugh.net/test/test57.html but
it's broken in modern versions of Opera (and possibly other browsers)
so I don't recommend it.

Steve

Benjamin Niemann's Avatar
Benjamin Niemann October 18th, 2005 04:55 PM
Guest - n/a Posts
#4: Re: height=100% is not working for Mozilla browser

Raghavendra wrote:
[color=blue]
> Here is my code.
> -------------------------------------------
> <div style="height:100%">
> <BODY>
> sample text spanning about 30 lines
> </BODY>
> </div>
> <table><tr><td>footer</td></tr></table>
> -------------------------------------------[/color]

What's that? You cannot have a BODY inside of a DIV, nor a DIV or TABLE
outside of the BODY... Whatever a browser makes of this mess is completely
undetermined.
validator.w3.org is your friend.
[color=blue]
> I am using this code to display the footer always at the end of the
> browser window.
>
> In IE the footer is getting displayed properly at the end even when the
> text does not span the window height.
>
> But in mozilla the footer is getting overlapped with the body text.
>
> Any help will be appreciated.[/color]

Not sure how good this version is, but you might give it a try:
<http://www.themaninblue.com/writing/perspective/2005/08/29/>

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
 
Not the answer you were looking for? Post your question . . .
196,797 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,797 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors