Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近建立了一个网站并使用margin: 0 auto. 我还将元素包装在.wrapper一个宽度设置为 960px 的类中,然后让父元素扩展到整个浏览器。
margin: 0 auto
.wrapper
但是,当我在 iPad 上查看Brands 屏幕时,该站点是左对齐的,并且没有延伸到整个窗口。关于为什么会发生这种情况以及如何纠正它的任何想法?
请参阅下面的屏幕截图:
看起来您在该页面上有一些验证错误:
我怀疑他们可能导致了这个问题。如果您在例如 Chrome 中查看该页面,您会在包装器之外看到一个水平滚动条和空间<div>,因此问题不仅限于 iPad。
<div>
这适用于宽度为 1024px 的居中网页:
<meta name="viewport" content="width=device-width, initial-scale=0.95, maximum-scale=0.95">