I have menu div in our site and we hav fixed this div through position:fixed css. Now we are creating another div at the top of menu div and would like to fix this as well. However when we are trying to add position:fixed css on this then it is overlapping by menu div.
<div class="top">
Div 1
</div>
<div class="menu">
Menu div
</div>
Could someone assist me on this ?
I have tried to add position: fixed on both div and tried other way as well but div is overlapping on each other.
3
Answers
I hope I have understood your question correctly. If I were you, I would create a fixed wrapper and then you can copy your two div blocks into it. See example:
try to add
to the div that you want to be down to the other
As it has already been suggested, you should make a fixed div and put your other div and the menu in it.
Alternatively, if you really don’t want to make another div, maybe you could set both of them to fixed, and set a margin-bottom to the top div (or margin-top to the bottom one). I tried using margin:auto; but it doesn’t seem to work, probably because of the position:fixed;, so you should set the margin manually.