Jump to content

How to hide code block??

Go to solution Solved by paul2009,

Recommended Posts

How do you hide code blocks from showing up as white space on your website?? This seems like a huge oversight on behalf of Squarespace. Unless there is an obvious way to do it I haven't found yet?

I have code blocks for my anchor links that obviously have to go in specific spots on my page and there's no place for them to just be inline with something else. And when I use "display: none" in the custom css, they stop working.

Any help would be greatly appreciated

Thanks!

Edited by zaw88
Initial Revision
Link to comment

It's not always necessary to hide a Code or Markdown Block. For example, if you've added an ID for an anchor link, it could be added with the code for the title of that section. For example:


<h2 id="myID">Heading</h2>

If you really do need to remove the spacing created by the Block, you'll need to remove the set the default 17 pixels of padding that appear on each side.

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment
  • 7 months later...
On 7/17/2019 at 2:02 PM, zaw88 said:

How do you hide code blocks from showing up as white space on your website?? This seems like a huge oversight on behalf of Squarespace. Unless there is an obvious way to do it I haven't found yet?

I have code blocks for my anchor links that obviously have to go in specific spots on my page and there's no place for them to just be inline with something else. And when I use "display: none" in the custom css, they stop working.

Any help would be greatly appreciated

Thanks!

I have this exact same question. It didn't mean anything when I was only using 1 link on the page. But now I have three anchor links and you can clearly see the space between the line above and the image below (https://www.callummckirdy.com/resources)

In answer to @paul2009 I have no heading that I can hide this behind unless I change the floating heading over the image which I don't really want to do.

So I ask again, like @zaw88 did, is there a way to hide these spaces?

Thank you.

Link to comment
7 hours ago, beren said:

I have this exact same question. It didn't mean anything when I was only using 1 link on the page. But now I have three anchor links and you can clearly see the space between the line above and the image below (https://www.callummckirdy.com/resources)

In answer to @paul2009 I have no heading that I can hide this behind unless I change the floating heading over the image which I don't really want to do.

So I ask again, like @zaw88 did, is there a way to hide these spaces?

Thank you.

Use this CSS

div#block-yui_3_17_2_1_1583627817214_9605 {
    padding: 0;
}

How to find block ID. https://chrome.google.com/webstore/detail/squarespace-collectionblo/bggpdfnccodbnmcndckmeehdjkjojkde

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • Solution
8 hours ago, beren said:

How do you hide code blocks from showing up as white space on your website?

If you really want to hide ALL code blocks then you can add this to Design > Custom CSS and it will remove the space created by the Code Block itself (17 pixels of padding around it):

.sqs-block.code-block.sqs-block-code {
  padding: 0;
}

Note that in your case, you have also added a paragraph (within the Code Block). For example, this is one of them:

<p id="cb-paper"> </p>

You'll therefore need to hide the space created by this too, using something like this:

.sqs-block.code-block.sqs-block-code p {
  margin-block-start: 0;
  margin-block-end: 0;  
}

 

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

Link to comment
  • 3 weeks later...
  • 2 months later...

Thanks for the CSS @paul2009. It worked perfectly for me. 

<table style="width: 430px;">
<tbody>
<tr>
<td width="288" style="width: 420px;">
<p style="color: #43414e;">Heather Hamilton</p>
<p style="color: #43414e;">Founder, Resume Insider</p>
<div style="color: #bc8420;">
<p><a href="https://resumeinsider.net/" style="color: #43414e;">Website</a>&nbsp; |&nbsp; <a href="https://www.facebook.com/resumeinsidernet" style="color: #43414e;">Facebook</a>&nbsp; |&nbsp; <a href="https://www.linkedin.com/in/heatherhamilton/" style="color: #43414e;">LinkedIn</a>&nbsp; | <a href="https://about.me/heatherhamilton" style="color: #43414e;">About me</a></p>
</div>
</td>
</tr>
</tbody>
</table>

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.