gpt4 book ai didi

html - 如何计算移动浏览器的div的高度

转载 作者:行者123 更新时间:2023-11-28 13:49:44 24 4
gpt4 key购买 nike

我正在尝试重新创建页面 http://www.rexonmedia.com/test/sohalo/images/html5_simpletest.png使用 HTML 5 和 CSS3 但高度有问题。我用 50px 测量了页脚的高度。它在普通浏览器上看起来不错,但在移动浏览器上它看起来非常小。我在这里错过了什么。是否有可以在移动浏览器上正确显示的标签或方程式?

HTML 测试

<link rel="stylesheet" type="text/css" href="style/reset.css" />
<link rel="stylesheet" type="text/css" href="style/styles.css" />

<meta name="description" content="The HTML5 Herald">
<meta name="author" content="SitePoint">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header> </header>
<div id="wrap">
<div id="main"> </div>
</div>
<footer> </footer>
</body>
</html>

CSS

@charset "UTF-8";
/* CSS Document */



header{
width:100%;
height:50px;
background-color:#113b44;
}

#wrap {
min-height: 100%;
}

#main {

}

footer {
position:fixed;
bottom:0px;
width:100%;
background-color:#231f20;
height:50px;
}

最佳答案

也许尝试在 CSS 高度中使用 pt 而不是 px?这是 Web 开发中很常见的问题。一种解决方案是检测用户屏幕分辨率并包括“移动”样式表。

关于html - 如何计算移动浏览器的div的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11514421/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com