简体   繁体   English

在HTML / PHP页面中设置PDF高度?

[英]Setting PDF height in HTML/PHP page?

I'm currently using this code to embed my PDF file on an HTML page: 我目前正在使用以下代码将PDF文件嵌入HTML页面:

<embed src="http://www.mywebsite.com/file.pdf" width="95%" type="application/pdf">

Is there a way that I can make the height be 80% of whatever the users current screen size is? 有什么方法可以使高度成为用户当前屏幕大小的80%? That way they can always view the entire PDF within the size of their screen? 这样一来,他们始终可以在屏幕大小范围内查看整个PDF?

Yes, it is possible. 对的,这是可能的。 Use this css: 使用此CSS:

body, html{
    height: 100%;
}

embed{
    height: 80%;
}

fiddle: http://jsfiddle.net/ntQVw/ 小提琴: http//jsfiddle.net/ntQVw/

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM