How to Center Custom Text in Squarespace with Code Block


Screenshot 2020-04-13 at 16.33.03.png

Why can’t this…

Screenshot 2020-04-13 at 16.30.53.png

… be centered like this?


If you want more CSS snippets, feel free to download my Top 15 Squarespace CSS Cheatsheet:


Does your html look something like this:

<h8> Portfolio </h8>

And your CSS something like: 

#block-c008bd5e92295e08c44ctext-align: center !important ;
  align: center !important;
}


… and you try several variations, but NOTHING will make the darn text center?

I scoured the internet for ages until I came across the most simple solution, it made me want to crawl into a hole. How did I NOT think of this earlier?! 

To save you having to make the same mistake, here is my super simple solution:

  • just wrap your html in: <center> </center>



WORK THROUGH SOLUTION:

So let’s assume your html looks something like this: 

<h8> Portfolio </h8>

Simply enclose that within this: <center> </center>

to look like this:

<center>
  <h8> Portfolio </h8>
</center>
 
or keep it all in one line: &lt;center&gt;&lt;h8&gt;Portfolio&lt;/h8&gt;&lt;/center&gt;

or keep it all in one line: <center><h8>Portfolio</h8></center>


And now your customised code block text will look like this:

Center text in Code Block Squarespace

Ooh, before you go! Grab my top 15 Squarespace CSS snippets (for 7.0 and 7.1). Try them out and watch the magic happen!


Did that work for you? Let me know if you have any questions! Happy custom coding friends!

 
Center Custom Text 1.png

pin me .

 

Similar articles you will love:


Emily Peilan

Squarespace Web Designer | Creating stylish, chic and modern websites that convert for the Creative Entrepreneur and Small Businesses. 

https://www.arohavisuals.com
Previous
Previous

How to find the Code Block ID in Squarespace? (for Custom CSS)

Next
Next

How to remove the header and footer only on specific pages in Squarespace?