定位手机

时间:2013-04-02 08:42:07

标签: javascript css mobile target

我想使用CSS媒体查询定位移动设备,如下所示:

@media (min--moz-device-pixel-ratio: 1.5),
       (-o-min-device-pixel-ratio: 3/2),
       (-webkit-min-device-pixel-ratio: 1.5),
       (min-resolution: 1.5dppx) {

   /* your retina rules here */
}

手机的正确设置是什么?假设我想避免使用平板电脑和大屏幕,只针对手机?

1 个答案:

答案 0 :(得分:3)

引用此answer

min-width: 320px  // smartphones, iPhone, portrait 480x320 phones
min-width: 481px  // portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide.
min-width: 641px  // portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 and 854x480 phones
min-width: 961px  // tablet, landscape iPad, lo-res laptops ands desktops
min-width: 1025px // big landscape tablets, laptops, and desktops
min-width: 1281px // hi-res laptops and desktops