我一直在尝试将我 body 的宽度设置为等于我的 Nexus 4 屏幕的宽度,我听说它是 768 像素。但是,我发现当手机处于直立位置时,我可以向右滚动相当多的量......如果我将宽度减半到 384px,我仍然可以稍微向右滚动......
我正在使用 Bootstrap。
HTML:
<body>
<div class="container">
<h1>Heading</h1>
</div>
<div class="container">
<button class="btn btn-primary">Settings</button>
</div>
<div class="container">
<button class="btn-primary">Received Messages</button>
</div>
CSS:
body {
background-image: url("wooden-floor.jpg");
width:384px;
text-align: center;
}
button {
margin-top:25px;
}
.container {
width:384px;
}
有人知道我应该怎么做才能纠正这个问题吗?
谢谢。
最佳答案
尝试在您的 CSS 中使用媒体查询并查看结果。请参见下文:
点击查看帮助
http://cssmediaqueries.com/what-are-css-media-queries.html
同样在 html 中
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
视口(viewport)呢?
关于html - CSS 宽度 - Nexus 4,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20794798/