css - 使用媒体查询景观

标签 css responsive-design media-queries

我使用媒体查询使我的页面在移动设备上响应,但注意到当设备旋转时它不会影响媒体查询。我怎样才能以即使在屏幕旋转(横向)时它仍然保持不变的方式使用它。

最佳答案

你应该使用设备方向

设备方向

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

供引用:1) click me 2) me too

关于css - 使用媒体查询景观,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36635416/

相关文章:

html - 使用 html5 的响应式布局

javascript - 当我调整屏幕大小时,jQuery 一直在前面加上另一个按钮

css - 为什么媒体查询中的 CSS 旋转不会旋转回来

css - 控制哪个边框位置设置 CSS 中的 Angular 像素

html - 在一个 div 中居中一个 div,并根据内部 div 使外部 div 自动调整大小

css - 如何让标题中的横幅流到 Logo 后面?需要有反应

javascript - 好主意还是坏主意 : Replacing all images on a mobile website with CSS property "content:url()" for retina displays

javascript - 调整大小后重新排序 div

html - Bootstrap容器间距

更改浏览器窗口的分辨率大小时,CSS 媒体查询不起作用