xRobot
xRobot

Reputation: 26565

How to fill a webpage with an iframe?

I need a way to fill the entire webpage with an iframe. This is my code:

<!DOCTYPE html>
<html>
 <head>
  <style>
   body{ margin:0px; width:100%; height:100%; }
   iframe{width:100%; height:95%; border:none;}
  </style>
 </head>
 <body>

  <iframe src="http://www.repubblica.it/"></iframe>

</body>
</html>

You can see it here: http://jsfiddle.net/8nh3kfws/1/

As you can see, the iframe doesn't fill the entire page but there is a big white space in the bottom. I have noticed that it works if I remove "<!DOCTYPE html>" but I don't know why.

So, How can I do it without removing "<!DOCTYPE html>" ?

Upvotes: 1

Views: 149

Answers (2)

Baso
Baso

Reputation: 1354

Specify a position to your iframe.

iframe{width:100%; height:95%; border:none; position: absolute}

Upvotes: 0

grgdne
grgdne

Reputation: 239

Add html to your style declaration.

html, body{ margin:0px; width:100%; height:100%; }

http://jsfiddle.net/8nh3kfws/2/

Upvotes: 1

Related Questions