我正在尝试删除桌面滚动,但继续为手机和平板电脑滚动。谁能告诉我为什么下面的代码不起作用?
/* Small devices (tablets, 768px and up) */
@media (min-width: @screen-sm-min) {
body {
overflow-y:visible;
}
}
/* Medium devices (desktops, 992px and up) */
@media (min-width: @screen-md-min) {
body {
overflow-y:visible;
}
}
/* Large devices (large desktops, 1200px and up) */
@media (min-width: @screen-lg-min) {
body {
overflow-y:hidden;
}
}
最佳答案
既然你已经知道你的媒体查询断点,为什么不直接在 PX 中做你的媒体查询而不是像这样 http://jsfiddle.net/96q3u6ne/
/* Small devices (tablets, 768px and up) */
@media (min-width: 768px){
body {
overflow-y:visible;
}
}
/* Medium devices (desktops, 992px and up) */
@media (min-width: 992px) {
body {
overflow-y:visible;
}
}
/* Large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
body {
overflow-y:hidden;
}
}
关于html - overflow-y 不适用于媒体查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31371922/