我需要定位处于横向模式的手机,但不知何故它不会在横向模式下更改 css。我在纵向媒体查询之后添加了横向媒体查询,如下所示:
@media screen and (max-width:767px)
{
}
@media screen and (max-width:767px) and (orientation:landscape){
.header-top-bar, .header, .row, .announcement, .menu-container {
width: 462px;
}
我需要按特定顺序使用它们吗?我的纵向媒体查询运行良好。
最佳答案
@media (max-device-width: 767px) and (orientation: landscape) {
.header-top-bar, .header, .row, .announcement, .menu-container {
width: 462px;
}
}
试试这个 max-width 到 max-device-width
关于css - 哪个媒体查询需要放在 css 文件中的第一个?纵向或横向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34629806/