iFrame not expand to 100% height

后端 未结 3 2079
借酒劲吻你
借酒劲吻你 2021-02-08 06:52

I have this below html. And I would like the iFrame to cover the rest of the screen with 100% on whatever left. I tried \"100%\" and \"*\" in height attribute but not working. W

3条回答
  •  北海茫月
    2021-02-08 07:36

    This CSS will should do the trick for you:

    body {
      margin: 0;
      padding: 0;
      overflow-y: hidden;
    }
    

    Then set the height of the iframe to 96%. This will stop it from being pushed off the bottom of the page.

    The reason you need this is because 100% height on the iframe is calculated as 100% of the available screen height. Since you've got a 35px tall div above the iframe, you end up with an iframe pushed 35px beyond the total screen height.

提交回复
热议问题