I have the following element:
<!-- language: lang-html --><div class="bottom-est">Bottom-Est</div>
<!-- language: lang-css -->
.bottom-est {
position: fixed;
width:100%;
bottom: 0;
border: 1px solid black;
background-color: orange;
}
Can I place another fixed position element right above it?
If it has a fixed/known height, I can just add bottom:##px
to displace it:
<div class="bottom-ish">Bottom-Ish</div>
<!-- language: lang-css -->
.bottom-ish {
position: fixed;
width:100%;
bottom: 18px;
border: 1px solid black;
background-color: yellow;
}
Which will accomplish the resulting goal:
But is there a way to do this that doesn't require knowing the height ahead of time. I can't modify .bottom-est
at all, but I can modify .bottom-ish
as much as I want.
body {
margin:0;
padding:0;
}
.bottom-ish {
position: fixed;
width:100%;
bottom: 18px;
border: 1px solid black;
background-color: yellow;
}
.bottom-est {
position: fixed;
width:100%;
bottom: 0;
border: 1px solid black;
background-color: orange;
}
<!-- language: lang-html -->
<div class="bottom-ish">Bottom-Ish</div>
<div class="bottom-est">Bottom-Est</div>
<!-- end snippet -->