简体   繁体   English

如何使嵌入的 pdf 文件在我的网站上全屏显示?

[英]How do I make my embedded pdf file to be full screen on my website?

This is what I've got but this doesn't solve the problem for different devices and screen sizes.这就是我所拥有的,但这并不能解决不同设备和屏幕尺寸的问题。

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

How do I make it full screen?我如何使它全屏? I've tried width: 100%;我试过宽度:100%; height: 100%高度:100%

For reaching fullscreen in this case you need to use height: 100vh;在这种情况下,要达到全屏,您需要使用height: 100vh; , width: 100%; 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 -->

Well, a simple snippet like the following one did the trick for me:好吧,像下面这样的简单片段对我有用:

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

Just play with the containers.只玩容器。

You should of course set your own container sizes to 100% and not html and body .您当然应该将自己的容器大小设置为 100% 而不是htmlbody

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何调整.htaccess文件以允许子文件夹中具有完整功能的网站 - How do I adjust my .htaccess file to allow a full functional website in a subfolder 如何在我的 Wix 网站上发送带有 PDF 文件的 email - How can I send email with PDF file on my Wix website 如果URL未指定文件,如何使我的网站加载特定文件? - How do I make my website load a specific file when the URL doesn't specify the file? 如何使用 php 为我的网站应用程序创建默认页面? - How do I make a default page for my website application with php? 如何让我的网站与树莓派通信 - How do I make my website communicate with a rasperry pi 如何使我的测试网站容易受到SQL注入的攻击? - How do I make my test website vulnerable to SQL injection? 如何让我的网站与下载管理器一起使用? - How do I make my website work with download managers? 如何为网站上的每个产品设置不同的URL? - How do I make a different URL for every product on my website? 如何建立到我网站页面的安全链接? - How do I make a secure link to a page on my website? 如何检查我的文件是否已上传,然后将文件上传的声明回显到我网站的特定部分 - How do i check if my file was uploaded and then echo my file uploaded statement to paticular part of my website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM