延伸阅读:meta标签viewport详解
html5默认允许用户缩放页面,如果需要禁止缩放,我们需要将user-scalabel=0设置下,具体代码如下:
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" />
注意:meta在head里。
<!DOCTYPE HTML>
<style>
body {
margin: 0;
padding: 0;
}
</style>
<script>
//window.onload = function () {
//}
</script>
<html>
<head>
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0,
user-scalable=0;"/>
<title></title>
</head>
<body>
...
</body>
</html>