检测并链接 iphone 3 和 iphone 4 的不同样式表
我试图通过这种方式为 iphone 3 和 iphone 4 定义不同的样式表
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" media="all and (max-device-width: 320px)" href="iphone3.css" />
<link rel="stylesheet" media="all and (max-device-width: 640px)" href="iphone4.css" />
,并且 iphone3.css 和 iphone4.css 都有一个 body{display:none;}
来测试它们是否正常工作,但在我的 iphone4 中我仍然可以看到网站,
我错过了什么?
谢谢!
I am trying to define different stylesheets for iphone 3 and iphone 4 this way
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" media="all and (max-device-width: 320px)" href="iphone3.css" />
<link rel="stylesheet" media="all and (max-device-width: 640px)" href="iphone4.css" />
and both iphone3.css and iphone4.css have a body{display:none;}
to test that they are working but in my iphone4 I still see the webiste,
what am I missing?
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这将同时针对 iPhone 3 和 4:
或者
您可以使用此查询覆盖以前的样式并仅针对 iPhone 4:
或者
This will target both iPhone 3 and 4:
or
You can use this query to then override the previous styles and target only iPhone 4:
or