css - 显示 : none doesn't work on mobile

标签 css sass

我在移动设备上遇到显示属性问题。显示:无根本不起作用。我正在使用SASS。这是我的代码:

main {
  display: none;
}

@media(min-width: $mobile-breakpoint) {
  main {
    height: 800px;
    display: flex;
    background-color: inherit;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    background-attachment: fixed;
    background-image: url("./images/main.jpg");
  }
}

最佳答案

在移动断点内使用display: none。 示例:

@media(min-width: $mobile-breakpoint) {
 main {
 height: 800px;
 display: none;
 background-color: inherit;
 background-repeat: no-repeat;
 background-position: center;
 background-size: cover;
 background-attachment: fixed;
 background-image: url("./images/main.jpg");
 }
}

关于css - 显示 : none doesn't work on mobile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49334741/

相关文章:

html - div内容相互重叠

php - 按钮没有被隐藏

jquery - 我们如何在图片上传上实现这些功能

css - Grav 和 Foundation SASS,它是如何工作的?

css - react js中每个组件的css隔离

css - SASS - 用户代理样式表覆盖链接颜色

javascript - 在html中更改占位符字体颜色

css - 将鼠标悬停在导航按钮上时侧边栏移动

html - 最大化 img 的大小

html - SASS 网格系统外部填充