Skip Navigation

[Resolved] Content template – Center align container content

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Christopher Amirian 1 year, 2 months ago.

Assisted by: Christopher Amirian.

Author
Posts
#2660497

Hello,

Is there a setting to centre align the content in a container? or is this only done by CSS?

#2660757

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

The container block does not have such a feature as it is meant to be a container of the other blocks.

You will need to use the inner block options that you use to make the text inside those blocks center aligned depending which block you use.

Container block does have the option for you to add a CSS class if you wish to use the CSS method.

Thanks.

#2660995

Understood, Thank you. I have an image above a text link and I'm not able to align the image in the centre. Just the text is aligned to the center. How do I align the image?

#2661073

Christopher Amirian
Supporter

Languages: English (English )

Hi there,

I will need more info about the setup, maybe if you can share the front-end link I can check and give you a CSS code.

But in general, you would add a CSS class to the container and the Image block.

For example, if you have the class of "the-content" for the container and "the-image" for the image a CSS like this should do the trick:

.the-content {
    text-align: center; /* Centers inline elements and text within the container */
}

.the-content .the-image {
    display: block; /* Make the image a block-level element */
    margin-left: auto; /* Auto margins work with block-level elements to center them */
    margin-right: auto;
}

Thanks.

#2661269

That worked perfectly! Thank you.