twan twan - 1 month ago 9
CSS Question

Logo not centered inside fixed menu when scrolling down

I bought a template that has a logo in the middle, but when I scroll down the logo moves and isn't centered anymore.

Example

I set position absolute and added left: auto, right: auto but still it is not centered. Why is that?

My page is exactly the same except I added:

position: absolute;
top: -1px;
left: auto;
right: auto;


on the sticked logo and:

position: absolute;
top: -30px;
left: auto;
right: auto;


on the main logo (not scrolled down).

Answer

try this css

.cbx-header .stick .cbx-logo {
left: 0;
margin: 0 auto;
position: absolute;
right: 0;

}