Reputation: 103
Creating a web application using asp.net mvc 2.
Attempting to add an iframe inside the Index page.
<div id="root">
<iframe src='http://restOfUrl' width='100%' height='100%'></iframe>
</div>
Iframe loads page inside 100% of width but only about 20% of height.
Tried adding multiple <br/>
above and below iframe tag to see if it has made any difference.
Page has expanded in height but iframe has remainded the same.
Please advise? Cheers
Upvotes: 0
Views: 193
Reputation: 258
Just give the 80% or 100% height to the parent element in your case
root{
height:80%
}
http://jsfiddle.net/9akc2jpy/1
Upvotes: 2
Reputation: 1396
height in % is depended on the parent element. if the parent element doesn't have a height set it will fail.
so there are 2 sollutions.
give parent div a height like so:
or 2. set the height in px, like so:
<div id="root" >
<iframe src='http://restOfUrl' width='100%' height='500px'></iframe>
</div>
http://jsfiddle.net/ns2vy6sx/1/
Upvotes: 1