css postion:fixed not working

66 Views Asked by At

I've a div element <div class="getBack">Get back to portfolio!</div>

and some css

.getBack{ height: 70px; width: 100%; position: fixed; z-index: 99; }

And for some reason, this position fixed doesn't work and I don't know why. It just scrolls up, out of sight

1

There are 1 best solutions below

2
On

You might need to set an actual position like top: 0; right: 0;. Also, make sure the parent element you want .getBack to be fixed relative to has a position other than static.