使用@media display:none隐藏固定位置DIV

时间:2015-06-30 16:09:57

标签: css css-position

有问题的div是:

  .fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 200px;
    background-color: white;
}

我想要的是:

@media screen and (max-width: 720px){
.fixed { display: none; }
}

然而,显然不是固定容器如何工作?

那么如何隐藏"粘性"容器当屏幕调整到太小而无法显示容器和主要内容,从而使容器与内容重叠?

1 个答案:

答案 0 :(得分:2)

您的css代码似乎运行正常,也许有一条规则比您的媒体查询更重要/重量,添加!importat并查看它是否有效:

@media screen and (max-width: 720px){
    .fixed { display: none !important; }
}