• Resolved kalel1970

    (@kalel1970)


    Hello,
    I customized my template leaving the justified texts by default. However, there is a paragraph that I want to center and when I use Gutemberg’s option to center it, I run it in the editor more, however, the text does not look centered online.
    I edited the HTML of the paragraph and wrote:

    <p class = “has-text-align-center! important”>

    as is the code of the H2, which I have centered.

    Still my paragraph is not centered.

Viewing 4 replies - 1 through 4 (of 4 total)
  • when I use Gutemberg’s option to center it, I run it in the editor more, however, the text does not look centered online.

    Some CSS code from your theme is probably overriding it. If you can give the URL to the page in question, I could tell you why it’s not working and give you a working CSS code to use.

    <p class = “has-text-align-center! important”>

    as is the code of the H2, which I have centered.

    No, your code is invalid — you can’t add ! important here. This belongs in the CSS and can’t be added to class name(s). And if your H2 has exactly the same code and is centered, it’s not this code that’s doing the centring.

    The correct code should be:

    <p class="has-text-align-center">
     -- Your text here --
    </p>

    But this is what is automatically applied by Gutenberg when you select to centre the text. If this is not working, something else on your site is overriding it. Please provide the URL to your page so I can check and help you out.

    Thread Starter kalel1970

    (@kalel1970)

    Thanks, the URL is URL of page

    You have placed this code in APPEARANCE => CUSTOMIZE => ADDITIONAL CSS. That’s what’s causing the Gutenberg centre alignment to not work. Just remove this code, and your Gutenberg centre alignment will work.

    article .entry-content p {
    	text-align: justify;
    } 

    Also, if you’re still able to edit your post, please mark the post title or link as NSFW (Not Safe For Work), or even remove the URL entirely.

    Thread Starter kalel1970

    (@kalel1970)

    Yes. It’s correct. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Center a paragraph in wordpress’ is closed to new replies.