我的网站中嵌入了excel。我想自动调整移动网站的大小。目前,手机屏幕的尺寸仍然太大。我怎样才能做到这一点?
谢谢!
<center><iframe width="1000" height="800" frameborder="0" scrolling="no" src="https://onedrive.live.com/embed?resid='Dashboard'!A1%3AL18&wdHideGridlines=True&wdInConfigurator=True"></iframe></center>
要使iframe成为视口的全宽和全高,请确保html
和body
设置为100%
的全height
和width
。完成后,您可以将iframe的height
和width
也设置为100%
。
html, body{
width: 100%;
height: 100%;
}
iframe{
width: 100%;
height: 100%;
margin: 0;
}
<html>
<body>
<iframe frameborder="0" scrolling="no" src="https://onedrive.live.com/embed?resid='Dashboard'!A1%3AL18&wdHideGridlines=True&wdInConfigurator=True"></iframe>
</body>
</html>
我已经测试了这个代码,它可以在手机、平板电脑和桌面视图中工作。