499
Views
6
Comments
Solved
How to center a text within a container?

Hi, 

I would love to centre the text in the middle of the container like the image shows below  :

I tried using the Align Center widget like this but still, nothing really changed


I also, don't want to make the text bigger like this, because for sure there is a better way to do it.


I also applied: "text-align-centre" » on the text widget » within the Style Classes 

Also, not the solution I am looking for based on the results that I've got.


I also tried the "Center content" widget within the container ... here is what I've got:



2018-08-27 08-29-35
Fábio Vaz
Solution

Hello,


Use flexbox css:

.center {

  display: flex;

  justify-content: center;

  align-items: center;

}

2024-03-27 13-27-06
Azhar Bondi

Thank you Fábio! This solved my issue!

2024-09-17 18-14-33
Miguel Defavari da Silva

Hello

You can use the Attributes tab to apply this style, as in the image below:

Just use "text-align: center" instead of "justify" (as in the image).

I hope this helps you!

Best regards,

Miguel


UPDATE: For the AlignCenter widget, did you change the IsHorizontal property to false?

2024-03-27 13-27-06
Azhar Bondi

Yes I tried to implement what you said 

The only solution that worked was Mr Fábio's solution but Thank you for your help as well! 

2018-08-27 08-29-35
Fábio Vaz
Solution

Hello,


Use flexbox css:

.center {

  display: flex;

  justify-content: center;

  align-items: center;

}

2024-03-27 13-27-06
Azhar Bondi

Thank you Fábio! This solved my issue!

2025-04-17 05-42-16
Ajit Kurane

Hi Azhar Bondi,

I am happy to help you.

I just noticed that its the wrong widget. You need to use Center Content instead of Align Center 

Note: Just to clarify. With Align Center you can align multiple widgets on their center. With Center Content you can center your content in the middle of the container. 

Hope it helps you.

Thanks,

Ajit Kurane.

2024-03-27 13-27-06
Azhar Bondi

 The only solution that worked was Mr Fábio's solution but Thank you for your help as well! 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.