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.
这是我第一次构建响应式网站,当我为 iPhone 定制 CSS 时,我遇到了问题。样式都正确应用,文本改变大小,包装改变宽度。问题是 iPhone 浏览器仍然以巨大的宽度打开,请看截图:
我在用着
@media all and (max-device-width: 480px) {}
设置特定的 iPhone css。body {width:;}不起作用。
body {width:;}
谢谢您的帮助 :)
您必须在页眉中添加以下内容
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
如:
<!doctype html> <html> <头部> <标题></标题> <meta name="viewport" content="initial-scale=1.0, width=device-width" /> </head> <正文> </正文> </html>