Site logo

Archived topic

How to centre align text within container?

5 replies · Started by CAZ on June 12, 2022

Viewing posts 1–6 of 6

Can't see the option to do this, help appreciated. I want the text within the container to be center-aligned.

Sure, here's an example (below) placeholder page, I want the title and body text to be centre aligned ideally!

If you want the content on that page to be centered then using this CSS is the easiest way:

body.page-id-8 .inside-article {
    text-align: center;
}

Adding CSS: https://docs.generatepress.com/article/adding-css/

It will only work in this page only as we are targeting .page-id-8

Okay - so no way to do this so every single page has text centred? I really wanted to set all H1s and H2s to be centred! Thank you for such a speedy reply :)

It's very tough for me to provide a solution without knowing the exact requirement.

I really wanted to set all H1s and H2s to be centred!

In that case, try this CSS:

.entry-content h1, .entry-content h2 {
    text-align: center;
}
This archived topic is closed to new replies.