CSS3媒体查询以特定设备为目标

gal*_*exy 1 wordpress css3 media-queries responsive-design

我有基本CCS的wordpress主题,现在我想让这个设计响应下面提到的大多数使用的设备布局.我想要在横向和纵向模式下定位所有苹果设备: -

blackberry(320x240),
iphone3 (320x480),
iphone4 (640x960),
iphone5 (640x1136),
ipad    (1024x768),
large desktop screen above 1280.
Run Code Online (Sandbox Code Playgroud)

如何使用CSS3媒体查询编写CSS样式表来定位响应设备?

Mar*_*ski 5

http://css-tricks.com/snippets/css/media-queries-for-standard-devices/ 这里只是一个启动者.您可以在该博客上阅读更多关于媒体查询和其他重复设计的内容.

这是一个css代码示例:

/* 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),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
}
Run Code Online (Sandbox Code Playgroud)