如何应用样式表只是iPhone(而不是IE),没有浏览器嗅探? [英] How do I apply a stylesheet just to the iPhone (and not IE), without browser sniffing?
本文介绍了如何应用样式表只是iPhone(而不是IE),没有浏览器嗅探?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想专门适用样式表于iPhone,而无需(通过用户代理字符串)在服务器上或通过JavaScript做浏览器嗅探。
I’d like to apply a stylesheet exclusively to the iPhone, without doing browser sniffing (via the user-agent string) on the server or via JavaScript.
我特别不想让Internet Explorer应用样式表。链接媒体=只屏(最大设备;
I particularly don’t want Internet Explorer to apply the stylesheet. Apple’s suggested code for applying an iPhone-specific stylesheet, i.e.:
<link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet">
似乎导致样式表由IE 7和6应用。
seems to cause the stylesheet to be applied by IE 7 and 6.
推荐答案
使用苹果的推荐代码,但在条件注释包裹,从IE隐藏:
Use Apple’s suggested code, but wrap it in conditional comments to hide it from IE:
<!--[if !IE]><!-->
<link media="only screen and (max-device-width: 480px)" href="small-device.css" type= "text/css" rel="stylesheet">
<!--<![endif]-->
我认为 Sitepoint的iPhone开发文章为此。
这篇关于如何应用样式表只是iPhone(而不是IE),没有浏览器嗅探?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文