如果 window 比 css 中的宽度高,有没有办法进行媒体查询? (任何设备的纵向与横向)

Is there a way to media-query if the window is taller than it is wide in css? (portrait vs landscape for any devices)

如果 window 比 CSS 中的宽度高,是否有媒体查询的方法? 任何设备的纵向与横向。

我知道 javascript 这很容易,但我正在寻找 CSS 唯一的解决方案。

这将select宽度大于 320 且小于 767 且方向仅为横向的设备。

@media screen and (min-width: 320px)and (max-width: 767px)and (orientation: landscape) {}

你想 select 高度和宽度组合的另一个例子:

@media (max-width: 320px) and (min-height: 400px) and (max-height: 812px) {}

尽管根据问题

,更好的用途是在您的情况下使用方向