Use CSS to Put Buttons Anywhere
Button blocks in Squarespace are a super easy and convenient way to add a good-looking and consistently stylized button to your page. The convenience of Squarespace also comes with some limitations that sometimes make ostensibly easy tasks difficult.
Let's look at an example:
This is a real-life example that I encountered on the home page of my own website.
It should be easy to put two buttons side by side—but it isn't because of how blocks are distributed into columns. On top of that, the content indent that I've set globally on my site to increase whitespace makes it so that text doesn't line up with side-by-side blocks, like this:
These two button blocks are both left justified and evenly spaced, but trying to put the second button closer to the first pushes the text in the first button onto two lines if the page is resized:
Both of those solutions look really bad. Wouldn't it be wonderful if we could just put buttons wherever we wanted them? Like this:
Learn More Project GallerY ⟶
Oh wait. We can!
Here's how it's done:
The two buttons in the third example are not actually button blocks. They are simply text styled with CSS to include a border and a background colour on hover. The advantage of this is that it allows you to put a button in any place that allows for text input.
CSS
You can put this in your sitewide custom CSS box (Design > Custom CSS), or in the page header code area.
If you put it in the page header, make sure to paste it between style tags (<style> PASTE CODE HERE </style>).
Style tags tell the browser that it is a CSS modification and not a <div> or a <script>. I've added comments to each line to attempt to explain what's happening.
/* This targets links(a) the 'h3' heading style in a specific text block, you dont have to isolate it to a singe text block. I did because I only want the modification in this article */ #block-yui_3_17_2_1_1532579407564_37882 h3 a:link, h3 a:visited { color: #6C7A89; /* button text colour */ border: 1px solid #6C7A89 !important; /*button border width and color*/ padding: 20px 30px; /*button height and width*/ margin-bottom: 15px; /*space after if they end up stacked on mobile*/ text-align: center; /*centers the text*/ text-decoration: none; /*defines underline, strikethrough, etc.*/ display: inline-block; /*hard to explain, but required*/ -webkit-border-radius: 3px; /*rounds the corners, set to 0 for square (chrome/safari)*/ -moz-border-radius: 3px; /*rounds the corners, set to 0 for square (firefox)*/ border-radius: 3px; /*rounds the corners, set to 0 for square (IE)*/ -webkit-transition: 0.35s background-color linear, 0.35s color linear; /*speed of colour transition on hover*/ -moz-transition: 0.35s background-color linear, 0.35s color linear; /*speed of colour transition on hover*/ -o-transition: 0.35s background-color linear, 0.35s color linear; /*speed of colour transition on hover*/ transition: 0.35s background-color linear, 0.35s color linear /*speed of colour transition on hover*/ } #block-yui_3_17_2_1_1532579407564_37882 h3 a:hover, h3 a:active { background-color: #6C7A89; /*hover background color*/ color: #FFF !important; /*hover text color*/ }
Other Applications
Like I mentioned before, you do this in any place that has linkable text. like an index gallery for instance.
If you had a linked text on an image in a Brine family index gallery, it would only be underlined. To change that underlined text you could target it and change it into a button:
.Index-gallery-item-content-body a{ /* this modifies the index gallery and 'a' targets links */ PASTE CODE HERE; }
This may be complicated to someone who doesn't know anything about CSS, but it's really quite simple once you understand the basics. I'm happy to assist anyone who has questions. Leave a comment if you need to add a custom button to your Squarespace website.
Related Articles:
Learn how to turn the inset border on a Squarespace section into a blurred image frame using just 6 lines of custom CSS. Step-by-step tutorial with a code generator.
Create a vertical scrolling testimonial carousel to any Squarespace site. Includes a live code generator where you can type in your own reviews, customize colors, speed, and card styles, and copy the finished code in one click.
Uploaded a video to Squarespace but can't find a way to download it back? Here's a quick workaround to retrieve your hosted video files when the download button is missing.
Learn how to add quizes, polls, and surveys to your Squarespace website without code using Opinion Stage. A free tool to turn quizes and polls into lead generators.
Create anchor links in Squarespace 7.1 without coding! Learn to make smooth scrolling internal links for same-page navigation, links to other pages, and SEO-friendly anchor links. Get solutions for unsupported sections too.
Create a typewriter effect header with a blinking cursor on your Squarespace site using one simple code block.
Add a 'View Project' button overlay to your Squarespace portfolio thumbnails. This code snippet is an easy plug-and-play solution to enhance your Squarespace website design.
Add a collapsible floating side navigation menu to your Squarespace site with this code snippet. Keep links accessible without clutter, customize icons and colors, while being fully responsive. Follow the step-by-step guide to integrate it seamlessly.
Learn how to customize the default 'Sign up for News and Updates' text in Squarespace forms with a simple JavaScript snippet. This quick guide will help you align your forms with your brand’s tone and messaging, boosting engagement and maintaining consistency.
In this tutorial I will teach you how to add a polaroid photo effect to the Squarespace Instagram block.
In this tutorial I will teach you how to change images on hover in Squarespace Fluid Engine and 7.1 using a very simple CSS code.
In this article I will guide you through the process of implementing the Ken Burns effect on your Squarespace images, galleries, and section banners using CSS.
When a member logs into their Member Area account, the page simply refreshes and the user panel opens. This can be confusing and not the best user experience. In today's article, I'll show you how to solve this problem by sharing a simple code snippet that you can add to your website
In today's digital landscape, websites must be designed with responsiveness in mind. As a Squarespace designer, one of the most important steps in my web design process is ensuring my websites are responsive and look amazing on all displays, be it mobile, tablet, or desktop.
Adding floating social icons that are always visible to your website is an easy way to encourage visitors to follow you on your chosen platforms and stay up to date with your content. Not only do these icons provide an easy way for visitors to connect with you, but they also contribute to the professional and cohesive look of your site. The new Fluid Engine update to Squarespace means the codes we used on 7.1 to achieve this are no longer viable and they need some tweaking.
In this article, I’ll show you how to create an anchor link sidebar navigation in Squarespace 7.1 and Fluid Engine.
In this article, I’ll show you how you can force the mobile navigation to show all the time, even when viewing on desktop browsers in Squarespace 7.1.
The Brine family of templates in Squarespace 7.0 offered a lovely, optional parallax feature that could be applied to banner images. 7.1 does not currently offer this option. However, with a little bit of code, we can add a (more flexible) version of the parallax effect to banner images in this updated design system.
There is a plethora of amazing effects that anyone familiar with CSS and/or Javascript can implement on a customized website. However, because the HTML is already written for you when you’re building with Squarespace, it can be difficult to add custom effects using a combination of HTML, CSS and Javascript, but it can actually be quite easy.
In this article, I’m going to show you how you can force the mobile navigation to show all the time, even when viewing on desktop browsers like I have on this website. It’s really quite simple!
Parallax web design effects have been growing in popularity for years. It’s a wonderful way to add visual interest you your website when done correctly.
Some time ago, I wrote an article outlining how to create slanted headers and footers. That small bit of code was then featured within the Ghost Plugins library, and I’ve since been bombarded with emails containing questions about how to add slanted sections within a Brine Index.
If you’ve spent any time building a Squarespace website, you know that it’s super easy to make a horizontal line by using a line block. But what about vertical lines?
As I gain more experience building websites on Squarespace, I continue to notice small nuances that are sometimes neat, sometimes annoying. Regardless of what it is, I often just want to change some small thing.
Squarespace made it easy for us website solopreneures to implement that annoying (but necessary) cookie banner on our own sites. I’ve only just turned it on on my own website, but was shocked to see this:
Button blocks in Squarespace are a super easy and convenient way to add a good-looking and consistently stylized button to your page. The convenience of Squarespace also comes with some limitations that sometimes make ostensibly easy tasks difficult.
Squarespace offers a tightly curated collection of templates that allow you to be your own designer and come out looking like an industry leader with a polished website, but it's easy to simply choose a template, plug in your photos and text, and end up with a website that looks exactly like the thousands of others with the same layout and styling.
One of the main concerns I've heard from clients and others thinking about using Squarespace is that they don't want their website to look and act like everyone else's site and look like a template.
Learn how to reposition your Squarespace header to the bottom of the page using a simple CSS code snippet.