公司需要写一个横屏时的友好提示功能,这里利用了 orientation: landscape
@media (orientation: landscape) {
body .swiper-container, html .swiper-container {
display: none;
}
body .orientation, html .orientation {
display: block;
}
}
竖屏时为:
orientation : portrait
本文介绍了一种使用CSS媒体查询实现横屏友好提示的方法。通过监听设备屏幕方向变化,在横屏模式下隐藏默认内容并显示提示信息。适用于需要优化用户体验的移动端网页应用。
126

被折叠的 条评论
为什么被折叠?



