【问题标题】:Center an iframe and make the height 100% that fits to the screen居中 iframe 并使高度 100% 适合屏幕
【发布时间】:2014-10-01 19:45:54
【问题描述】:

我正在制作一个 iframe,它将加载另一个网站的链接。我很难让它的高度 100% 适合用户的屏幕,同时我想为宽度指定特定的 px。谢谢你,对不起我的英语。 `

【问题讨论】:

    标签: html


    【解决方案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>
    

    【讨论】:

      【解决方案2】:

      如果您只针对现代浏览器,那么height: 100vh 应该这样做。否则需要使用javascript。

      另见

      100% screen height css

      【讨论】:

        猜你喜欢
        • 2013-07-27
        • 2016-04-22
        • 2010-09-24
        • 2012-07-09
        • 2011-08-17
        • 2020-12-07
        • 1970-01-01
        • 2017-12-08
        • 1970-01-01
        相关资源
        最近更新 更多