如何在没有浏览器嗅探的情况下将样式表应用于iPhone(而不是IE)?

Pau*_*ite 4 css iphone internet-explorer mobile-safari ios

我想将样式表专门应用于iPhone,而无需在服务器上或通过JavaScript进行浏览器嗅探(通过用户代理字符串).

我特别不希望Internet Explorer应用样式表.Apple推荐的应用iPhone特定样式表的代码,即:

<link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)

似乎导致样式表由IE 7和6应用.

Pau*_*ite 15

使用Apple的建议代码,但将其包装在条件注释中以将其隐藏在IE中:

<!--[if !IE]><!-->
<link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet">
<!--<![endif]-->
Run Code Online (Sandbox Code Playgroud)

我认为对于Sitepoint的iPhone开发文章.