BLOG
Why Copy-Pasting CSS Into Squarespace Sometimes Breaks Your Site
You found a snippet on a forum, pasted it into Custom CSS, and three things changed that you did not ask for. The snippet was almost certainly fine. The problem is not what the rule says - it is which elements the rule reaches.
The question to ask before you paste
A CSS rule has two halves. There is the declaration - border-radius: 20px - which
says what should change. And there is the selector - the part before the curly brace - which says
where it applies.
Almost every "the CSS broke my site" story is a selector problem wearing a declaration disguise. The value was right, the target was wrong. So before pasting anything, read the selector and ask: what will this match on my site?
.button {
border-radius: 20px;
}
This says: every element carrying the class button. On a Squarespace site that is
plausibly every button on every page - navigation, newsletter signup, contact form, checkout -
not just the one you were looking at.
#collection-5f3a91c2 .button {
border-radius: 20px;
}
This says: every element carrying the class button, but only inside the page whose
collection ID is 5f3a91c2. Same declaration. Completely different blast radius.
CSS is not "what does this code look like" - it is "where does this rule apply". Learn to read the selector and most of these failures stop happening.
Squarespace-specific ways the scope surprises you
Themes share class names
Squarespace's own markup uses classes like .sqs-block-button-element,
.summary-item and .image-block across many block types and many pages.
A rule written for one instance of a block frequently matches others that look nothing alike -
including inside the mobile menu, the footer, and the cart.
Page IDs are the reliable narrow-down
Squarespace gives most pages a #collection-... ID on the body element, and each
block sometimes carries a block ID too. Prefixing your selector with the page ID is the single
most effective way to keep a change contained:
/* site wide - risky */
.sqs-block-button-element { border-radius: 4px; }
/* one page only - safe */
#collection-5f3a91c2 .sqs-block-button-element { border-radius: 4px; }
Per-page code injection exists for this reason
Squarespace lets you add CSS on a single page (Page Settings → Advanced → Page Header
Code Injection, wrapped in a style element). If a change is meant for one page, put
it there rather than in the site-wide Custom CSS panel. It keeps the rule narrow without relying
on you remembering the collection ID.
The theme also has rules, and they are fighting you
Your pasted CSS does not land on a blank page. It lands on top of the theme's stylesheet, and when two rules of equal specificity disagree, the later one wins. Sometimes yours wins, sometimes the theme's does, and the visible result is the confusing part: the same snippet works on one template and does nothing on another.
Why !important makes it worse, not better
When a rule does nothing, the natural next step is to force it:
.button {
border-radius: 20px !important;
}
It works immediately, which is why it spreads. The cost arrives later:
-
Every future rule needs it too. Once one declaration is marked important, the
only way to override it is another
!importantwith equal or higher specificity. Six months later your Custom CSS panel is a stack of forced declarations. - You lose the ability to make exceptions. "All buttons rounded except the checkout button" becomes awkward, because the forced rule does not yield to a more specific selector.
- Nobody, including future you, can tell which rule is winning. Debugging becomes guesswork.
The better response to "my rule did nothing" is almost always a more specific selector, not a louder declaration. That is more work once and less work forever.
The five failure modes, and what actually caused them
"Every button on the site changed"
Selector too broad. Narrow it with a page ID, or move the rule into that page's code injection.
"It looks right on desktop and wrong on a phone"
Either the value is too large for a small screen - 32px padding is generous on desktop and enormous on mobile - or the theme applies different rules inside a media query and your rule is not competing there. Test at three widths (Squarespace's own preview does this) before you call it fixed.
"One page is fine and another page is affected too"
Same cause as the first, but harder to notice because you were not looking at the other page. This is why step four of the safer workflow is to check another page after every paste, not just the one you were editing.
"It stopped working after a Squarespace update"
The platform changed its markup or class names, and your selector no longer matches anything. Rules that lean on internal class names are inherently fragile. Two habits reduce the damage: keep a note of what each block of CSS was for, and prefer targeting things the platform documents over things you discovered in Inspect.
"I do not know which rule is doing this"
The accumulation problem: two years of pasted snippets, some with !important, some
commented, some forgotten. There is no clever fix. The practical approach is to comment each
block with a date and purpose when you add it, and when something is broken, disable blocks in
halves until the culprit is isolated.
A three-minute check before you paste anything
- Read the selector out loud. "Every element with this class, everywhere." If that is more than you meant, narrow it.
-
Count what it matches. Right-click the element, choose Inspect, and paste
document.querySelectorAll('your-selector-here').lengthinto the browser console. The number is the blast radius. If it says 47, you are about to restyle 47 things. - Decide where it belongs. One page means page-level injection. Site-wide means the Custom CSS panel, and a comment explaining why.
- See it before you commit. Paste the section into the CSS Code Editor, render it, and change the value there rather than experimenting on the live site.
- Check two other pages afterwards. Especially one with a different template.
Step two is the one people skip, and it takes fifteen seconds. It is also the only step that tells you the truth rather than a plausible story.
What CardKit is and is not doing here
Being precise about this matters. CardKit does not scan your Squarespace site, does not know which elements a selector will match on your live pages, and does not claim to "fix" Squarespace automatically. No browser tool can, without your site in front of it.
What it does is narrower: it lets you see what a block of CSS does to a section before that block touches your site, and change one value and watch. That removes the most common cause of damage - adjusting values blind, on a live page, with save as the only feedback loop. It does not remove the need to read the selector, and nothing does.
Real scenarios
The shop owner and the newsletter button. She pasted a button rule from a forum and got exactly what she wanted on her homepage - plus a pill-shaped newsletter button in the footer of every page. One selector prefix later, the change was contained.
The consultant who escalated. His rule did not apply, so he added
!important. Six months later he wanted one page to differ and could not override his
own rule. Rewriting it as a page-scoped selector took the same time the original fix did.
The blogger after a platform update. Her carefully tuned summary-block CSS stopped working overnight because a class name changed. Because she had commented each block with its purpose, she knew which one to re-inspect instead of auditing all forty lines.
Questions people ask
Is CSS from forums or AI dangerous?
Usually it is syntactically fine. The risk is scope and context - the author wrote it for their markup, not yours. Treat any snippet as a draft to be scoped and seen, not as a finished answer. AI Can Write CSS covers the same point for generated code.
Why does the same snippet work on one site and not another?
Different templates ship different markup and different competing rules. A selector that matches on one theme may match nothing on another, and a value that wins the cascade on one site may lose it on the next.
How do I undo something if it goes wrong?
Remove the block you just added rather than adding a counter-rule. Counter-rules are how simple CSS becomes unmaintainable CSS. Keep a copy of what you pasted, with the date, so undoing is deletion rather than archaeology.
Should I avoid Custom CSS entirely?
No - it is the intended place for site-wide rules. Use it for changes you genuinely want everywhere, and use page-level injection for everything else. The mistake is not the panel; it is putting page-specific rules in it.
The short version
Pasted CSS breaks sites because of scope, not syntax. Read the selector, count
what it matches, prefer a narrower selector over !important, and see the change
before you save it.
The full routine is in A Safer Workflow for Editing Squarespace CSS, and if a snippet came from an assistant rather than a forum, the same rules apply - see How to Edit AI-Generated CSS Without Asking AI to Rewrite Everything.