Turn links into buttons within Squarespace Image blocks using CSS

Squarespace boasts a variety of tools to help designers construct beautiful webpages, but sometimes custom code (Squarespace CSS and HTML) is needed to make a webpage truly unique.

Trotting on with our image block styling series, and to whet your appetite for Rebecca’s free CSS button basics course, I’ve created a little plugin for you to use to turn links into buttons.

This is a very handy piece of code that can be used give your site a unique flourish.

HERE IS A PREVIEW OF THE FINAL SQUARESPACE PLUGIN:

 
Screenshot 2019-08-27 at 15.01.46.png

PLEASE NOTE:

To target the individual image blocks for the effect, I have used the associated “Block ID’s”. These can be found using your browser’s developer tools and inspecting each element; however, I would highly recommend installing the “Squarespace Collection/Block Identifier” plugin if you use Google Chrome, for a quicker and easier solution.

Preparing the Image Blocks

Before we can add our code, we need to configure our image blocks so that they display both the image title and image description.

This is important as our code will modify these two elements almost exclusively.

Simply add an image block into your webpage > on the “IMAGE” dialogue box that opens up, click on the “Design” tab > select “Poster” > click on “APPLY”.

You can do this as many times as you need to, but this article covers four image blocks displayed in a grid-format.

image+block+setup.gif

The CSS Code

Replace the “Block ID’s” with your own; remember, you don’t need to only one image block for this code to work, you can have as many as you want.

PLEASE NOTE:

If you find you want to change certain aspects of the button, like the background colour or the font-size for example, I’ve left comments in the code as to where you can make these changes.