微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使尺寸适合屏幕的高度

如何解决使尺寸适合屏幕的高度

这肯定是一个微不足道的问题,但我已经困扰了很长时间。 问题很简单,即:我有一个具有特定尺寸 (450x800px) 的区域,我希望该区域始终适合屏幕的高度。

我在此附上我正在编写的示例代码,非常感谢能帮助我的人!

<!DOCTYPE html>
<html>
<head>
     <Meta name="viewport" content="height=device-height,initial-scale=1.0">
<title>Page Title</title>
<style>
html,body {  height: 100%;  margin: 0;}
.full-height {  height: 100%;  background: yellow;}
</style>
</head>
<body>
<div class="full-height">
    <div style="width:450px; height:800px; margin-left:auto; margin-right:auto; background-color:#FD0F13">I am a DIV that will stretch to fit the whole width and height of the browser window!</div>
</div>
</body> </html>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。