媒体查询目标iphone/mobile/ipad

Kan*_*ngo 0 css media-queries responsive-design

我正在使用媒体查询来定位iphone/ipad/mobile.

我写了以下媒体查询.

但我的问题是,如果我在移动'max-device-width:480px'的媒体查询中写css,它也将适用于iphone.

我做错了吗?

For mobile : like samsung grand(480 * 800):

@media only screen 
    and (max-device-width : 480px)
    {

        }


For iphone:

@media only screen 
and (max-device-width : 320px) 
 {

 } 


For ipad:
@media screen and (min-width:760px)
 {

 }
Run Code Online (Sandbox Code Playgroud)

还添加了元标记:

<meta name="viewport" content="user-scalable=no,initial-scale=1">
Run Code Online (Sandbox Code Playgroud)

Raj*_*iya 10

尝试使用以下媒体查询和元标记

/* For mobile : like samsung grand(480 * 800): */
@media screen and (max-width : 480px){}


/* For iphone: */
@media screen and (max-width : 320px){} 


/* For ipad: */
@media screen and (max-width : 768px){} 
Run Code Online (Sandbox Code Playgroud)

另外.更改您的元标记:

<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
Run Code Online (Sandbox Code Playgroud)