Jump to content

Anchor links - reduce padding on linked headers

Recommended Posts

Site URL: https://nextcitylawyer.com/free-resources/the-truth-about-virtual-vacation-schemes

Good afternoon

I have added anchor links to the blog posts on my website in order to make it easier for visitors to navigate long blog posts.  The anchor link functionality works well, but the code block includes a substantial amount of top and bottom padding which breaks up the page.  It's more than the equivalent with a conventional h3 header.

<p id="attitude"><h3>
1. Attitude

This is an example of the code that I have used on the linked page.  Is there a way to reduce the vertical padding between the blocks of the text?

Thanks for your help in advance.  I regard anchor links as a core feature of any blogging platform so it would be very useful to get some guidance on this issue.

Link to comment
  • Replies 1
  • Views 1k
  • Created
  • Last Reply
.sqs-block.code-block.sqs-block-code * {
    margin-top: 0px !important;
    margin-bottom: 0px !important;

.sqs-block.code-block.sqs-block-code {
    padding-top: 0px !important;
    padding-bottom: 0px !important;

That will remove the top and bottom spacing from the code blocks and elements inside the code blocks.

If you have other code blocks that you want to keep the padding and margins on, this can be adjusted to target specific pages and/or code blocks.

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.