完全由css检测iPhone / iPad [英] Detect iPhone/iPad purely by css
本文介绍了完全由css检测iPhone / iPad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直试图通过样式表检测iPhone或iPad。我尝试了通过使用@media掌上电脑,只有屏幕和(max-device-width:480px){。这里提供此处的解决方案。 p>
但是,这似乎不工作。任何想法?
解决方案
这是我处理iPhone(和类似)设备[
$ b
在我的CSS文件中:
@media only screen and(max-width:480px) ,只有屏幕和(max-device-width:480px){
/ * CSS覆盖为移动这里* /
}
在我的HTML文档的头部:
< meta name =viewport content =width = device-width,initial-scale = 1,user-scalable = no>
I've been trying to detect an iPhone or iPad purely by stylesheet. I tried the solution provided here by using @media handheld, only screen and (max-device-width: 480px) {.
However, this doesnt seem to work. Any ideas?
解决方案
This is how I handle iPhone (and similar) devices [not iPad]:
In my CSS file:
@media only screen and (max-width: 480px), only screen and (max-device-width: 480px) {
/* CSS overrides for mobile here */
}
In the head of my HTML document:
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
这篇关于完全由css检测iPhone / iPad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文