Jump to content

Change background color of Text Block?

Recommended Posts

  • Replies 26
  • Views 116.3k
  • Created
  • Last Reply

The easiest way is to probably use a Markdown Block instead of a Text Block. Let’s say you have this written in a text block:
“And here’s to you, Mrs. Robinson, Jesus loves you more than you will know.”

Paste it into a Markdown Block and surround the part you want to “highlight” with span tags like this:


"And here's to you, <span style="background-color:green">Mrs. Robinson</span>, Jesus loves you more than you will know."

Link to comment
  • 5 months later...

tazmeah’s suggestion of Markdown blocks is fantastic. You can also insert divs with your own styling such as background colors. Note that if you put two Markdown blocks next to each other, Squarespace will automatically merge them for you into one Markdown block.

So here’s an example of two text blocks with custom (light gray via alpha) background color. One block is on top of the other with some space in between them (via margin-top), and some padding around the divs on top/bottom:


<div style="background-color:rgba(0, 0, 0, 0.0470588); text-align:center; vertical-align: middle; padding:40px 0;">
<a href="/donate">DONATE</a>
</div>

<div style="background-color:rgba(0, 0, 0, 0.0470588); text-align:center; vertical-align: middle; padding:40px 0; margin-top:30px">
<a href="/blog">VIEW THE BLOG</a>
</div>

Link to comment
  • 3 months later...
  • 8 months later...
  • 6 months later...
  • 9 months later...
  • 11 months later...
  • 3 weeks later...
  • 4 months later...

Just to get clear, if you copy and past when @jpeksin wrote it won't work. The reason is that SquareSpace's MarkDown can't cope with more than three space characters at the start of each line.

i.e. This fails:

but this works:

DONATE

Cheers

J

I am new here. I am trying to develop a simple website on SquareSpace. So far I am finding it pretty darned frustrating.

Link to comment
  • 1 year later...

Hi @mrobinson99, I made a video tutorial for you on how to Change Background Color. Hope this helps! https://www.askquesty.com/post/change-background-color

Have Squarespace questions/task and need help today? **You can hire us here.** Our answers are on-demand, video recorded, and only cost between $5 to $25. Estimates are free, 100% satisfaction guarantee, and trusted by hundreds of small businesses.

Link to comment
  • 11 months later...
4 hours ago, ashleemundywebsitede said:

Thanks for the video! What would you add to the code to change the color of the text inside the block? And also the line spacing? Thanks!

Add to Home > Design > custom CSS

#enter-text-block-id {
	background: red;
}
#enter-text-block-id * {
	color: white;
}

Find ID with: https://chrome.google.com/webstore/detail/squarespace-collectionblo/bggpdfnccodbnmcndckmeehdjkjojkde

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 3 months later...
3 hours ago, Nanakoco said:

Hi, how can I change the background color into a 50% transparent white, so the text block is just a bit lighter than the color it is on?

Use rgba color, eg

Quote

background-color: rgba(0,0,0,0.5) /* black with 50% transparent */

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 4 months later...
1 minute ago, overflowg said:

Is there a way to have this span the entire width of the page, edge to edge, in the Hayden 7.0 template?

Yes. Possible. I just answered a similar question 5 minutes ago. Is it your post or?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 1/12/2021 at 10:11 PM, tuanphan said:

Yes. Possible. I just answered a similar question 5 minutes ago. Is it your post or?

I posted a similar question but the code provided unfortunately removed the padding from the images below that text block. Any solution for that? I forgot I had two accounts. Will need to remove this one.

Link to comment
On 1/14/2021 at 11:22 AM, overflowg said:

I posted a similar question but the code provided unfortunately removed the padding from the images below that text block. Any solution for that? I forgot I had two accounts. Will need to remove this one.

Can you share link to that post? We can check again easier.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 4 weeks later...

I have a issue with the effects of the code displaying only when I go to Design --> Custom CC. It has to do with this code specifically, which creates a translucent-white background for text in a specified block:

#block-848b3e4b0bc6ae27ccc5 {   <---- my block ID

background-color: #f0f0f088;

padding: 1px;

text-align: center;

}

 

Any ideas what went wrong?

Link to comment
16 hours ago, Mania said:

I have a issue with the effects of the code displaying only when I go to Design --> Custom CC. It has to do with this code specifically, which creates a translucent-white background for text in a specified block:

#block-848b3e4b0bc6ae27ccc5 {   <---- my block ID

background-color: #f0f0f088;

padding: 1px;

text-align: center;

}

 

Any ideas what went wrong?

Can you share link to page where you added text? We can help easier

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.