媒体查询,可同时定位智能手机纵向和横向


我希望将

一些样式应用于智能手机,无论是纵向还是横向。

是否有针对这两种方案的良好媒体查询?实际上,我必须使用两个媒体查询重复css:

.selector {
// smartphone portrait
@media (min-width: 320px}) and (max-width: 512px}) {
    // stuff
}
// smartphone landscape
@media only screen and (device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2) and (orientation: landscape) {
    // same stuff
}
}
我相信

,如果您创建一个媒体查询,最小宽度是纵向手机屏幕宽度,最大宽度是横向手机屏幕宽度,无论方向如何,它都应该覆盖所有内容。

最新更新