Fixed position doesn't work

Hi, in every project i work with fixed position for the nav bar. Because i don’t like the jumping thing on the sticky nav bar from Blocs.

The code works finde in every project. But now in Blocs 4.4.1 it doesn’t work in a new project.

<style>
.fixed {
top:0px;
position: fixed;
z-index: 999;
}
</style>

Could anybody help?

Does the inspector show the position is being over-ridden?

Also you know you can make this in the class editor, no need to place in header.

Yes i know, but it does work. But the question is, why the code is not working on the new project.

Is this correct?

I’ll check with the latest build when I get back on my Mac, but I also just remembered there is a bootstrap class called .fixed-top you could use also.

You’ll need to set the top to 0px. to achieve the same. Also, you increased your z-index by an additional 9000. I just learned you’ll need to be careful with crazy numbers, as the z-index is relative.

2 Likes

Thanks. But nothing works.

@RME

Looks like the .bloc class is over-ridding stuff. Even the Bootstrap Class .fixed-top

So the easy solution would be to use your normal code, but add !important

<style>
.fixed {
top:0px;
position: fixed!important;
z-index: 999;
}
</style>

It will be a lot easier to fix this stuff, once we can add !important to styles in the class editor :wink:

5 Likes

Would be a nice “Plus” feature :grinning:

2 Likes

So many times, I wish this forum would let you respond with more than a :heart:

1 Like

I’ll accept two :heart: :heart:

1 Like

Perfect. It works fine !!! :heart_eyes:

4 Likes

I stumbled upon this old topic. (I had the same issue recently.)
Wondering, does the nav-bloc need to be of the .bloc class, or could it be changed/overridden?
(Not sure why, but adding !important all over feels somehow wrong.) :thinking: :sweat_smile: