固定导航栏后的容器具有动态高度
问题描述:
我有一个具有动态高度的标题(最小高度:50像素).
I have a header with a dynamic height (min-height: 50px).
当然,它可以高于50像素.我想要一个容器,容器下面有一些内容.
Of course, it can be higher than 50px. I want a container with some content right below it.
我可以用页边距或其他格式设置吗?
Can I do that with a margin or some other formatting?
答
您是说那样的东西吗?
body {
height: 500px;
background-image: linear-gradient(to bottom, #eee 0%, #000011 100%);
}
.header-container {
position: fixed;
width: 100%;
top: 0px;
left: 0px;
}
.header {
min-height: 50px;
padding: 15px;
background-color: #72f072;
}
.header-container .header p,
.header-container .something p {
margin: 0px;
}
.header-container .something {
padding: 15px;
background-color: #fff;
}
<div class="header-container">
<div class="header">
<p>some content</p>
</div>
<div class="something">
<p>some other content</p>
</div>
</div>