【问题标题】:How to determine if a device is in portrait or landscape mode using CSS如何使用 CSS 确定设备是处于纵向还是横向模式
【发布时间】:2013-10-17 19:16:09
【问题描述】:

为了确定屏幕尺寸,我使用的是media queries,但我想确定设备是否在portrait or landscape mode using CSS 中,这样我就可以根据屏幕尺寸获得不同的背景图像。

有什么想法吗?

【问题讨论】:

    标签: css responsive-design media-queries landscape-portrait


    【解决方案1】:

    只需为横向和纵向模式编写媒体查询:

    /* Portrait */
    @media screen and (orientation:portrait) {
    /* Portrait styles */
    }
    /* Landscape */
    @media screen and (orientation:landscape) {
    /* Landscape styles */
    }
    

    link here

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 2011-04-10
    相关资源
    最近更新 更多