我有一个 HTML 页面,其中有一个页面,里面有一个内容,当我设置最后一个 div 的图像时,里面有一个 div。在图像下方显示空白并使html页面处于滚动位置。我不想要空白,想根据设备的高度和宽度来适应页面。但我无法实现它任何帮助将不胜感激
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="user-scalable=no" id="viewport_meta" />
<script type="text/javascript">
var viewport_meta = document.getElementById('viewport_meta');
var w = screen.availWidth;
var h = screen.availHeight;
viewport_meta.setAttribute('content', 'width=' + w + ', height=' + h + ',user-scalable=no');
</script>
<script src="tizen-web-ui-fw/latest/js/jquery.js"></script>
<script src="tizen-web-ui-fw/latest/js/tizen-web-ui-fw-libs.js" data-framework-viewport-scale="false"></script>
<script type="text/javascript" src="./js/main.js"></script>
<script type="text/javascript" src="./js/swipe.js"></script>
<script src="tizen-web-ui-fw/latest/js/jquery.min.js"></script>
<script type="text/javascript" src="./jquery.mobile-1.3.0.js"></script>
<link rel="stylesheet" type="text/css" href="./css/style.css" />
</head>
<body>
<div data-role="page" id="page1">
<div data-role="content" data-scroll="none">
<div id="fullpage"></div>
</div>
</div>
</body>
</html>
在 div id 整页上,我设置了背景图片:
body {
background-repeat: no-repeat;
margin: 0;
overflow: hidden;
}
div {
width: 1280px;
height: 720px;
}
#page1{
width: 1280px;
height: 720px;
}
#fullpage {
background-image: url(../images/lastslide_en_752.jpg);
background-repeat:no-repeat;
background-size:60% 60%;
}