html - 如何使部分透明的导航栏后面的内容消失?
问题描述
我的页面顶部有一个部分透明的导航栏:
<div class="navbar">
Content
</div>
.navbar {
position: sticky;
top: 0;
width: 100%;
z-index: 999;
background-color: rgba(212, 0, 255,0.3);
}
页面的背景是画布。
问题是当我向下滚动时,内容不会消失在我的导航栏后面,因为导航栏是部分透明的。我只希望页面背景和导航栏显示在导航栏区域而不是内容
解决方案
用这个!
.navbar {
position: absolute !important;
}
推荐阅读
- protractor - 类型错误:table.count 不是函数
- javascript - 尝试检查文本框是否为空并提醒用户
- c - Linux 中 __FUNCTION__ 的加宽版本
- installation - 为什么使用 MSI 安装程序安装的应用程序会从 Windows 中消失
- python - 检查值是否遵循后续时间序列值的标准
- r - 有没有办法根据可变长列表过滤数据框?
- scala - 要求失败:重新排序中断 - Spark Cassandra
- dart - 卸载应用程序后,sharedpreferences 会发生什么情况?
- java - 有没有一种工具或方法可以根据 POST JSON 数据在 Java 控制器中自动生成所有 GET 获取请求 API 端点
- javascript - 如何使用通过 Javascript 加载的 Chrome 开发工具调试 Javascript 文件?