Jump to content

Custom CSS code for text center alignment in mobile view not working

Go to solution Solved by Lesum,

Recommended Posts

Hi there,

I want specific text blocks to be centered when in mobile view. I used this guid:

https://www.bigcatcreative.com/blog/center-text-squarespace-mobile

I copied the code and placed the text blocks ID but the alignment doesn't change at all.

My css code:

@media only screen and (max-width: 767px) {
  #block-647813601532e36e44cc, 
  #block-f3bc99c03357a8e13b28{ 
    text-align: center; 
  }}

On my main page it's the very first word "Welcome" that should be centered.

Password for my website: maxterVFX2023

Link to comment
  • Replies 4
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Solution

@Maxter To center the "Welcome" heading, you can add this code snippet within the Custom CSS panel:

@media only screen and (max-width: 767px) {
  #block-647813601532e36e44cc h4{ 
    text-align: center !important; 
  }
}

To center the paragraph below the "Welcome" heading, you can add this code snippet:

@media only screen and (max-width: 767px) {
	#block-e5eadfc5dd19a44d59e2 p {
		text-align: center !important;
	}
}

 

If my comments were useful, please like or mark my solution as answer so others can scroll to it quickly. 

Sam
Web Developer & Digital Designer

 Did you find my contribution helpful? Buy me a coffee?

Link to comment
45 minutes ago, Lesum said:

@Maxter To center the "Welcome" heading, you can add this code snippet within the Custom CSS panel:

@media only screen and (max-width: 767px) {
  #block-647813601532e36e44cc h4{ 
    text-align: center !important; 
  }
}

To center the paragraph below the "Welcome" heading, you can add this code snippet:

@media only screen and (max-width: 767px) {
	#block-e5eadfc5dd19a44d59e2 p {
		text-align: center !important;
	}
}

 

Thank you very much Lesum!

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.