html - 让白色导航栏覆盖表单 div
问题描述
当后者滚动到顶部时,我希望白色导航栏覆盖表单 div。如何做到这一点?
css
.navbar {
position: fixed;
top: 0;
width: 100%;
height: 60px;
......
}
.info-form {
width: 60%;
margin-left: 20%;
margin-top: 7%;
......
}
html
<div id="root">
<div>
<div className="navbar"></div>
<form className="info-form"></div>
</div>
</div>
解决方案
使用位置:粘性;
.navbar {
...
position: sticky;
top: 0;
}
推荐阅读
- python - 数据框 Python 的 Bigrams
- postgresql - 如何让函数在 Postgresql 中的 DO 语句中工作
- python - 通过flutter DIO包调用Post请求时抛出未处理的异常错误
- python - 如何将 PIL 图像从 python 发送到 Node.js?
- php - Mysql数据库插入“空白”数据而不是用户通过php连接输入的实际数据
- angular - 增加字数限制
在角度 - r - 我的 R 生成的 Unifrac PCoA 图与 QIIME 中生成的图不匹配,我不知道为什么。有人有这方面的经验吗?
- function - 更改天数的 uint 变量的函数会产生错误-solidity
- python - 如何将数组中的多个句子转换为python中的单个响应?
- c# - Dapper - <>f__AnonymousType.....类型的成员不能用作参数值