我的移动设备媒体查询在横屏模式下无法正常工作,可能是我没有正确显示media only screen
。我没有使用任何框架,只是普通的CSS...
有人能指点一下我吗?提前感谢。
这就是我现在的样子。
@media (min-width : 319px) and (max-width: 480px){
//css here
}
我不确定我做错了什么。
我的移动设备媒体查询在横屏模式下无法正常工作,可能是我没有正确显示media only screen
。我没有使用任何框架,只是普通的CSS...
有人能指点一下我吗?提前感谢。
这就是我现在的样子。
@media (min-width : 319px) and (max-width: 480px){
//css here
}
我不确定我做错了什么。
在CSS中有一个有用的属性/函数叫做orientation
,它有两个选项:
你可以这样使用它:
@media screen and (orientation:landscape) {
/* Your CSS Here*/
}
为了设定屏幕的最大和最小宽度,你可以尝试以下方法:
To attach the screen max and min width you can do something like this:
@media screen and (orientation:landscape)
and (min-device-width: 319px)
and (max-device-width: 480px) {
/* Your CSS Here*/
}
请参考这个链接:css expanding based on portrait or landscape screen size?,以及这个页面上关于@media
查询的文档:https://css-tricks.com/snippets/css/media-queries-for-standard-devices。
希望这能帮到您 :-)
video {
width: 100%;
}
@media screen and (orientation:landscape) {
video {
height: calc(100vh - 110px);
}
}
100vh等于您的视口高度的100%。
110像素是我的导航栏的高度,(只需要根据您的尺寸进行调整)