Forum Moderators: not2easy

Message Too Old, No Replies

Wierd 3px Gap.in FF for a change

Gap at bottom of IFRAME

         

Dabrowski

6:18 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a bit of code, I have a tiny footer at the bottom of my clients site with an IFRAME to an equally tiny link to my own website.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

<head>
<title>Test Page</title>
<style>

* { margin: 0; padding: 0; border: 0; }

HTML { height: 100%; overflow: auto; }
BODY { height: 100%; font-size: 10px; }

#footer {
position: absolute;
bottom: 0;
width: 100%; height: 15px;
background: gainsboro;
}
#footer IFRAME { width: 100%; height: 15px; }

</style>
</head>

<body>

<div id='footer'><a href='http://www.some-made-up-name.co.uk' target='_blank'><iframe frameborder='0' src='http://www.some-made-up-name.co.uk/site-by-my-company.htm'>Website designed and hosted by My Company</iframe></a></div>

</body>

</html>

In IE6 and IE7 no problems, in FF for some reason it inserts a 3px gap after the IFRAME, causing a scrollbar, and the actual DIV height to be 18px.

At first thought it was the line-break problem you get in IE, but still there after putting it all on one line. No margin, padding or border so I'm at a loss as to where it's coming from.

Anybody come across this?

Fotiman

7:41 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your DOCTYPE is not correct. It seems you want a transitional DOCTYPE:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

Dabrowski

8:02 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Why is that then?

Fotiman

8:27 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Because you are using transitional items in your code (like the iframe element, the target attribute, and the frameborder attribute). Try validating your page and you will see:
[validator.w3.org...]

If you give it the correct DOCTYPE, then it lines up correctly.

Dabrowski

9:55 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks again Fotiman, that has fixed it. Strange side effect of an invalid DTD though.

Is there a good website where I can see what I can use in loose, and what I can use in strict?

Fotiman

10:29 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, there's always the DTD's themselves, though they can be somewhat overwhelming and hard to read if you're not familiar with them:

[w3.org...]
[w3.org...]

I'm not sure if there are any sites that put it into a better format.

Dabrowski

11:11 pm on Apr 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looked at those before. I can understand them if I can be bothered to go through it all. Not exactly an interesting read though. Kinda like reading my Windows registry.

It would be nice if someone knows of a handy website where there's a quick reference.