2

我已经完成了一个网站,它现在在浏览器中运行良好。我被要求使其与 Android、iPhone、iPad、平板电脑和网络等兼容。我正在使用 bootstrap asp.net。

现在我正在尝试,找不到任何答案。我正在使用这些内联媒体查询

@media screen and (min-width:0px) and (max-width:320px){/*Any css will be defined here*/}
@media screen and (min-width:321px) and (max-width:480px){/*Any css will be defined here*/}
@media screen and (min-width:481px) and (max-width:540px){/*Any css will be defined here*/}
@media screen and (min-width:541px) and (max-width:775px){/*Any css will be defined here*/}
@media screen and  (min-width:768px) and (max-width:783px){/*Any css will be defined here*/}
@media screen and (min-width:776px) and (max-width:1536px){/*Any css will be defined here*/}
@media screen and (min-width:1537px){/*Any css will be defined here*/}

但在某些 iPad 中,没有应用 CSS。现在我的问题是,@media 的标准分辨率和方向是什么,它将涵盖所有(Android、iPhone、平板电脑和 Web 等)CSS?

4

2 回答 2

5
/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
}

/* Smartphones (landscape) ----------- */
@media only screen 
and (min-width : 321px) {
/* Styles */
}

/* Smartphones (portrait) ----------- */
@media only screen 
and (max-width : 320px) {
/* Styles */
}

/* iPads (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) {
/* Styles */
}

/* iPads (landscape) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : landscape) {
/* Styles */
}

/* iPads (portrait) ----------- */
@media only screen 
and (min-device-width : 768px) 
and (max-device-width : 1024px) 
and (orientation : portrait) {
/* Styles */
}

/* Desktops and laptops ----------- */
@media only screen 
and (min-width : 1224px) {
/* Styles */
}

/* Large screens ----------- */
@media only screen 
and (min-width : 1824px) {
/* Styles */
}

/* iPhone 4 ----------- */
@media only screen
and (-webkit-min-device-pixel-ratio : 1.5),
and (min-device-pixel-ratio : 1.5) {
/* Styles */
}

这就是我使用的,它几乎适用于所有东西。

于 2013-08-24T12:45:11.707 回答
1

花了很多时间后,我发现这很有帮助。这是 Bootstrap 本身使用的,我遵循了它。它将涵盖所有设备(Android、iPhone 标签和网络等)。

    @media handheld, only screen and (max-width: 2200px)
    {
     /* Styles */
    }
    @media handheld, only screen and (max-width: 1200px) 
    {
     /* Styles */
    }
    @media handheld, only screen and (max-width: 1024px) 
    {
    /* Styles */    
    }
    @media handheld, only screen and (max-width: 767px) {
     /* Styles */
    }
    @media handheld, only screen and (max-width: 600px) {
     /* Styles */
    }
    @media handheld, only screen and (max-width: 500px) {
     /* Styles */
    }
    @media screen and (-webkit-min-device-pixel-ratio:0) {
    /* Styles */
    }
于 2013-08-24T14:46:52.140 回答