【问题标题】:CSS3 media queries to target specific device针对特定设备的 CSS3 媒体查询
【发布时间】:2013-01-01 03:19:03
【问题描述】:

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

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

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

【问题讨论】:

    标签: wordpress css responsive-design media-queries


    【解决方案1】:

    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 */
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-25
      • 2014-05-19
      • 2016-05-20
      • 1970-01-01
      • 2023-03-26
      • 1970-01-01
      • 2013-01-15
      • 1970-01-01
      相关资源
      最近更新 更多