【问题标题】:How do I make my embedded pdf file to be full screen on my website?如何使嵌入的 pdf 文件在我的网站上全屏显示?
【发布时间】:2020-10-01 06:34:17
【问题描述】:

这就是我所拥有的,但这并不能解决不同设备和屏幕尺寸的问题。

<html>
<body>
<iframe src="FILE LINK" width="1920" height="1080"></iframe>
</body>
</html>

如何让它全屏显示?我试过 width: 100%;高度:100%

【问题讨论】:

    标签: php html css iframe fullscreen


    【解决方案1】:

    为了在这种情况下达到全屏,您需要使用height: 100vh;width: 100%;

    body {
    margin: 0;
    }
    
    html {
      box-sizing: border-box;
    }
    *,
    *:before,
    *:after {
      box-sizing: inherit;
    }
    .landing {
      width: 100%;
      height: 100vh;
    }
    .image-list {
      margin: 0;
      padding: 0;
      list-style: none;
      width: 100%;
      height: 100vh;
      border: 6px solid #00f;
      overflow: hidden;
    }
    .image-list .image {
      border: 6px solid #f00;
      width: 100%;
      height: 400px;
      background-size: cover;
      background-position: center center;
      height: 100vh;
    }
    .centered-element {
      position: absolute;
      top: 50%;
      left: 50%;
      -webkit-transform: translate(-50%, -50%);
              transform: translate(-50%, -50%);
      background: #fff;
      padding: 1rem;
      width: 280px;
    }
    .centered-element ul {
      margin: 0;
      padding: 0;
      list-style: none;
    }
    .centered-element ul span {
      opacity: 0.4;
    }
    <!-- body -->
    
    <section class='landing'>
        
        <ul class='image-list'>
            <li class='image'
                    style='background-image: url(https://unsplash.it/1600/1600)'>
            </li>
            <li class='image'
                    style='background-image: url(https://unsplash.it/1600/1800)'>
            </li>
            <li class='image'
                    style='background-image: url(https://unsplash.it/1600/1700)'>
            </li>
        </ul>
        
        
    </section>
    
    <!-- /body -->

    【讨论】:

      【解决方案2】:

      嗯,像下面这样一个简单的 sn-p 对我有用:

      body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 5px;
        box-sizing: border-box;
      }
      
      html {
        height: 100%;
      }
      &lt;iframe src="#" width="100%" height="100%"&gt;&lt;/iframe&gt;

      只是玩容器。

      您当然应该将自己的容器大小设置为 100%,而不是 htmlbody

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-01-06
        • 2011-05-04
        • 2021-05-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-01-02
        相关资源
        最近更新 更多