John
John

Reputation: 4706

iframe height attribute not working with Firefox

My Firefox (version 3.6.17 on Ubuntu) is not responding to the height attribute of my iframe. (I checked that it works on my Google Chrome.)

<iframe src="www.example.com" width="100%" height="80%"></iframe>

or

<iframe src="www.example.com" width="100%" height="40%"></iframe>

How can I make it work?

If it's because my Firefox version is too old, how can I make it work for users who similarly have old version of Firefox?

Upvotes: 4

Views: 11554

Answers (1)

kierzniak
kierzniak

Reputation: 606

I have checked yout code in firefox 3.6 on OS X and this is working for me. To get it working I have added:

html, body { height:100%; } ​

http://jsfiddle.net/XcdJ3/

However if you have iframe in some container, it must have also height:100% property.

Like in this example:

http://jsfiddle.net/XcdJ3/2/

If you can't expand iframe with html and css try to do it in JavaScript, just take parent element height and apply it to iframe height tag.

Upvotes: 6

Related Questions