Make center text center aligned

NisantaSahoo
Contributor

Hello,

 

I believe this code is making my text column-wise and I am unable to make it center aligned 
<div class="grid__col grid__col--1of2">.

 

Can someone help with what code I should use the make the text center aligned?

 

PS. I have limited coding skills 🙂

0 Upvotes
5 Replies 5
JanetArmstrong
Contributor | Partner
Contributor | Partner

There are horizontal spacer modules you can put to the left and right to reduce the width and center your content. Or you can use css and give it a maximum width and center it with auto margin, but sounds like you want to avoid code.

 

Anton
Thought Leader | Partner
Thought Leader | Partner

Hi @NisantaSahoo,

if you want to center the text in the column. You can:

 

  1. add inline-styling

like this

 

<div class="grid__col grid__col--1of2" style="text-align:center">

 

to it. It will work, but I don't recommend inline-styling

 

  1. create a simple CSS class

like this

module/template(or where ever this div is)

<div class="grid__col grid__col--1of2 text-centered">

Your main CSS file:

.text-centered{
text-align:center;
}

 

This will give you more control over media queries(responsiveness).

 

 

best, 

Anton

Anton Bujanowski Signature
NisantaSahoo
Contributor

Hi Anton,

Thanks a lot for the response, but I do not want the text to be centered inside the column. That's not my purpose, I want it to be center aligned on the page. Please take a look at the design layout scrnli_9_8_2022_11-31-10 AM.png

 

0 Upvotes
Anton
Thought Leader | Partner
Thought Leader | Partner

Hi @NisantaSahoo

 

could you please post a preview link to the page (not template)?

 

Thank you

 

Anton

Anton Bujanowski Signature
0 Upvotes
NisantaSahoo
Contributor

I didn't get you, the page is not published yet

0 Upvotes