Site logo

Archived topic

Breadcrumb centering on archive pages

7 replies · Started by Marc-Andre on June 4, 2021

Viewing posts 1–8 of 8

Hello, I added breadcrumbs to all my posts and centered them with this simple additional CCS code :

#breadcrumbs {
text-align: center;
}

Now I added breadcrumbs to the archive pages via the hook element and it works, however they are not centered but left aligned and I don't understand why the additional CSS doesn't apply. Is there a way to correct that?

Hi there,

Which hook are you using for the archive page?

Hi Leo, I'm using : generate_before_main_content

Try this instead:

.archive #breadcrumbs {
    margin-left: auto;
    margin-right: auto;
}

It's almost working. It center the breadcrumbs, but the breadcrumbs itself is not entirely centered, I,m not sure how to explain correctly in English, so I put a link in the private box for example.

Just in case it's important, I need this CCS AND the one I was already using. If I simply replace it, the breadcrumbs from the post return to a left alignment.

Hmm can you actually try using the generate_before_archive_title hook?

I didn't thought about making a second hook. It works perfectly. For your information, I don't need the additional CSS to center the breadcrumbs, only the one I was already using :

#breadcrumbs {
text-align: center;
}

Thank you for your great support!

No problem :)

This archived topic is closed to new replies.