Create a Color Gradient for a Line Block in Squarespace

Looking to add a little drama to your Squarespace website?


in this blog post, I'm going to show you how to create this really cool gradient effect for a horizontal line block in Squarespace using custom CSS.


Turn that ordinary line block into an eye-catching dividing element that looks something like this (but yours will be way cooler):

 
Line block with color gradient in Squarespace
 
 

Follow These Easy Steps to Create a Color Gradient for Your Line Block in Squarespace

  1. In edit, add a line block, position it wherever you like it, and save

  2. In your pages panel, scroll down to website tools > Custom CSS

  3. Copy the code below and paste it into Custom CSS

  4. Change the hex codes to whatever colors you like

 
 
/* Add a color gradient to a line block */

hr {
  background: linear-gradient(to
  right,#BD005B,#E55937,#FFE974);
}

 
 
 

Change the Direction of the Gradient

See where the code snippet says “to right?” If I wanted to reverse the direction, simply change the wording to read, “to left.”

Play Around With the Colors

Try using the same hex code on the ends and a different one in the middle.

And you can even add more colors to this if you want. Simply add a comma after the last hex code and add an additional hex code.

 
 

Isolate a Line Block

The code snippet is going to target every line block on your Squarespace website. If you want to isolate one particular line block, you'll need the Squarespace block identifier Chrome extension, which you can get here.

  1. Select the block identifier from your Chrome browser—all the section IDs and block IDs on your webpage will be displayed

  2. Locate the block ID that represents the block you're trying to target and select it—it automatically copies it to the clipboard

  3. Go back to the code and right before the “hr,” paste that block ID and then add a space

  4. Save

  5. Click on the block identifier again to get rid of all that messiness


If you want to target more than one line block, but not all of the lines on your Squarespace website:

  1. Select the block identifier from your Chrome browser

  2. Locate and select the block ID of the line you want to target

  3. Go back over to your code snippet and after the “hr” add a comma and paste the block ID, ad a space, then type “hr”

  4. Save

 
 

Was this helpful?

Are you going to try this? What will you use it for? Tell me about it in the comments. 👇


 
 

This page contains affiliate links

 
 

My Insta

@jenxwebdesign

 

Like this post?

Pin It to Pinterest 👇

Create a Color Gradient for a Line Block in Squarespace
Jennifer Barden

This article was written by Jennifer Barden, founder of Jen-X Website Design and Strategy.

Many Squarespacers feel defeated when their websites don’t attract and engage visitors.

In my blog, I share my secrets for effective Squarespace website design and strategy so that DIYers and Squarespace Website Designers can learn tips for building Squarespace websites that attract and engage the right visitors.

https://jenxwebdesign.com
Previous
Previous

The 6 Types of Images That Improve Blog Post Engagement

Next
Next

Create a Timeline for Your Squarespace Wedding Website