Property & constructionSites that prove the work before the first call, from planning to handover.
Every industry buys differently, so every industry gets its own page.All industries →

Gradient Buttons on Squarespace: CSS Tutorial

To add gradient buttons on Squarespace, target your button in Custom CSS and set its background to a linear-gradient. Then check your text is readable across the whole gradient.

By Mikkel Calmann, Founder, TypzaUpdated 4 min read

In this article
  1. Add gradient buttons to your Squarespace site
  2. What are gradient buttons in Squarespace
  3. How to create gradient buttons on Squarespace
  4. How gradient buttons work for visitors
  5. Why use gradient buttons
  6. Conclusion
  7. FAQ
  8. More insights

A gradient can help a button stand out and adds some depth. Here's the code, plus how to customise it.

1. Add gradient buttons to your Squarespace site

Gradient buttons blend multiple color tones smoothly across the background instead of relying on a single solid color, giving otherwise flat calls to action a sense of depth.

2. What are gradient buttons in Squarespace

We use gradient buttons most often to emphasize primary calls to action, create modern hero section buttons, and reinforce dynamic brand identities that a flat color alone can't capture, much as a button shadow effect adds depth through light rather than color.

3. How to create gradient buttons on Squarespace

Step 1: Open the Custom CSS panel

  1. Log into your Squarespace account.

  2. Open your website dashboard.

  3. Click Pages.

  4. Scroll down and select "Custom CSS" under "Custom Code."

Step 2: Add the gradient button CSS

// Gradient buttons - Typza.com //

.sqs-button-element--primary, a.sqs-block-button-element--primary { background: linear-gradient(90deg, #166FD4 10%, #0f5aa8 50%, #123643 100%) !important; color: #ffffff !important; transition: opacity 0.3s ease; }

.sqs-button-element--primary:hover, a.sqs-block-button-element--primary:hover { opacity: 0.9; }

This applies a horizontal gradient, forces white text, adds a smooth opacity transition, and slightly dims the button on hover.

Step 3: Save and test

Click Save and review the buttons across hero sections, forms, and pricing pages, then test mobile responsiveness.

Step 4: Customize the gradient

Adjust the values inside linear-gradient(90deg, color1, color2, color3). Try alternative angles like 135deg for a diagonal gradient, adjust the color stop percentages, or simplify to just two colors. Whatever you land on, verify the text stays accessible against the background.

4. How gradient buttons work for visitors

Gradients increase visual prominence by naturally drawing the eye, differentiating primary actions from everything else on the page, reinforcing quality perception, and making conversion points feel intentional rather than accidental.

5. Why use gradient buttons

Strategic use elevates brand sophistication, creates stronger visual contrast, reinforces modern positioning, and increases perceived value, the same subtle polish a button scale up hover effect brings to a call to action, though improper use risks inconsistent behavior and accessibility issues.

Conclusion

Add the code to one button style first. Then check your text against both ends of the gradient with a contrast checker, and look at it on your phone. If it passes and still suits your brand, use it across the site.

FAQ

What are gradient buttons and how do they differ from flat buttons?

Gradient buttons use a linear-gradient background that blends two or more colours across the button, instead of a single flat colour. That adds depth and a more modern feel. We use them most often for main calls to action and hero section buttons, where a flat colour alone can't capture the brand.

How do I control the angle of a gradient button in CSS?

The linear-gradient() function takes an angle as its first value, like 90deg or 135deg. That angle sets the direction the colours blend across the button. 90deg blends from left to right, and 135deg gives a diagonal. You can also adjust the colour stop percentages, or simplify the gradient to just two colours.

Can I animate a gradient on hover?

Yes. Common approaches include shifting the gradient's background-position on hover, or changing the opacity or colour stops. Both need a transition property to animate smoothly. Our example code uses a 0.3 second opacity transition. Test any hover effect on your phone too, since touch screens handle hover differently.

Do gradient buttons cause accessibility issues?

They can, if the text doesn't have enough contrast against every part of the gradient. Check both ends, not just the darkest or lightest point. Run each colour stop through a contrast checker against WCAG ratios. If the text fails anywhere on the button, darken that colour stop or change the text colour.

Will gradient buttons work with Squarespace's built-in button styles?

Yes. You can override the background of any built-in Squarespace button class with a gradient using Custom CSS. This doesn't change the button's shape or spacing. Add the code to one button style first, check it with a contrast checker and on your phone, then use it across the site if it suits your brand.

More insights about squarespace tips

All squarespace tips insights

How does your website score?

Enter your address and email. You get scores for speed, search, accessibility and trust in about a minute, and the full report by email.