-1

I am making an iframe which will load a link of another site. I am having a bad time in making the height of it that 100% fits the screen of the user and at the same time I want to specify particular px for the width. Thankyou and sorry for my English. `

Vin
  • 1
  • 3

2 Answers2

1
<html>
    <head>
        <style>
            .wrapper{
                margin:0 auto;
                width:40%;
            }
            iframe{
                height:100%;
                width:100%;
            }
        </style>
    </head>
    <body>
        <div class="wrapper">
        <iframe src="http://www.w3schools.com/tags/att_iframe_src.asp"></iframe>
        </div>
    </body>
</html>
Moussawi7
  • 12,359
  • 5
  • 37
  • 50
0

If you are only targeting modern browsers then height: 100vh should do it. Otherwise need to use javascript.

See also

100% screen height css

Community
  • 1
  • 1
Ruskin
  • 5,721
  • 4
  • 45
  • 62