2
Hello,
I have a site with a Fixed menu at the top which I put the header class, and it accompanies the scroll bar, I know that my other div with the content class needs a margin according to the header height to not be capped. My doubt is how I do it flexibly. Whatever the header height the div contain margin is changed without me having to change the margin every time.
html {
background-color: #bcbcbc;
}
.header {
background-color: white;
height: 100px;
top: 0;
left: 0;
width: 100%;
position: fixed;
}
.header h2{
text-align: center;
}
.content{
height: 100%;
}
.footer {
background-color: black;
height: 100px;
width: 100%;
}
<div class="header">
<h2>FIXED</h2>
</div>
<div class="content">
<h1>Conteudo</h1>
<h1>Conteudo</h1>
<h1>Conteudo</h1>
<h1>Conteudo</h1>
<h1>Conteudo</h1>
<h1>Conteudo</h1>
</div>
<div class="footer">
</div>
It is worth remembering that
position:sticky
only has support in more modern navagadores, IE for example does not support. It would be nice to put the reference for future queries: https://caniuse.com/#feat=css-Sticky– Jorge.M
@Jorge. M without problems I made the observation in the answer.
– hugocsl