mrchipotle225 mrchipotle225 - 5 months ago 8
CSS Question

How do I fix my CSS so that menu stays fixed on top of a container that uses flexbox?

So here is the code I'm working with. I first had a container with flex, and that allowed me to place predictors and taglist on the left hand side (one on top of each other, this is fixed position) and the rest to the right side of it.

Now I wanted to add a menu that would stay on top and be fixed, i.e. stays there while I scroll. But I can't seem to do that, and doing

position: fixed
on the menu puts it to the left and over the predictor/taglist section.

Here's a js fiddle of what I have.

https://jsfiddle.net/o72oj083/

Answer

Here is your working FIDDLE

Just add top:0px and give body a padding-top:30px.

Hope that helps Thanks :)

Comments