固定导航栏后的容器具有动态高度 [英] Container after fixed navbar with dynamic height
本文介绍了固定导航栏后的容器具有动态高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个具有动态高度的标题(最小高度: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>
这篇关于固定导航栏后的容器具有动态高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文