【问题标题】:overflow-y not working with media queries溢出-y 不适用于媒体查询
【发布时间】:2015-07-13 04:05:25
【问题描述】:

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

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

【问题讨论】:

  • 您能否提供 html 或为它创建一个小提琴?

标签: html twitter-bootstrap css media-queries


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2018-05-12
    • 2013-08-07
    • 2013-06-05
    • 2015-09-06
    • 2015-12-18
    • 2013-12-05
    • 2017-12-02
    • 2015-03-08
    • 1970-01-01
    相关资源
    最近更新 更多