Built-in anchor links for Squarespace are here! Using the Anchor Link input in the section editor, we can easily add unique anchor links to specific sections on our page.

Anchor Links in Squarespace

Anchor Links in Squarespace

These anchor links are added as id attributes on the page section, which means we can target sections using #anchor-link instead of [data-section-id="123"], which is much much nicer.

Note

If you want to learn how to add anchor links within a section. Check out this article.

 
#anchor-link {
  // CSS here
}
CSS
Site Footer Code Injection area
 

One quirk to the Squarespace anchor links though is that you can’t have the same anchor link twice on the same page (a big no-no in html land). So here is some code that allows you to target sections by a specific string in the anchor link text.

 
[id*="anchor-link"] {
  // CSS here
}
CSS
Site Footer Code Injection area
 

You can also customize the anchor link offset. So when a user navigates to a specific section, you can offset the scroll amount using the scroll-margin property.

 

Offsetting a specific anchor link

#anchor-link {
  scroll-margin: 150px;
}
CSS
Site Footer Code Injection area
 

Offsetting all anchor links

[id] {
  scroll-margin: 150px;
}
CSS
Site Footer Code Injection area
 
Will Myers

I support web designers and developers in Squarespace by providing resources to improve their skills. 

https://www.will-myers.com
Next
Next

Clickable Thumbnails on List Section Banners