overflow-y不使用媒体查询

时间:2015-07-12 19:54:11

标签: html twitter-bootstrap css3 media-queries

我尝试删除桌面滚动,但继续滚动手机和平板电脑。谁能告诉我为什么下面的代码不起作用?

/* 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;
    }
}

1 个答案:

答案 0 :(得分:0)

由于您已经知道了媒体查询的断点,为什么不在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;
    }
}