Custom Line of Text Above the Navigation in Squarespace

There are times when you find yourself wanting to insert a simple, easy-to-manage line of text across the top of your site’s navigation for a special holiday message, maybe a promotional announcement, or any other simple greeting, without having to inject the HTML or change actual page markup.

If you’re on Squarespace 7.1 and you’d like a non-heavy (or no-code-injection) way of doing this, you can do it with one line of CSS, using the before pseudo-element on your navigation bar.

Here’s what it looks like done properly (and responsively), building on the code you’ve given us.

Base Code

This is the basic CSS snippet you're using:

Copied!
.header-nav:before {
    content: "enter your text";
    display: block;
    position: relative;
    top: -20px;
}

It works, but let’s improve it for:

  • Better layout stability

  • Centered alignment

  • Readable styling

  • Cross-device consistency

Improved Professional Version

Copied!
.header-nav::before {
  content: " Free shipping on orders over $50!";
  display: block;
  position: relative;
  top: -20px;
  text-align: center;
  background-color: #f4f4f4;
  color: #333;
  font-size: 15px;
  padding: 10px 0;
  font-family: inherit;
  z-index: 999;
}

Key Enhancements

Style Purpose
text-align: center; Align the message neatly above your nav
background-color & color Ensures visibility and brand consistency
padding Adds breathing room for aesthetics
font-family: inherit; Keeps consistency with your site typography
z-index: 999; Prevents overlapping issues with sticky headers or dropdowns

Optional: Mobile Adjustment

To hide the text on mobile or change the font size:

Copied!
@media screen and (max-width: 768px) {
  .header-nav::before {
    font-size: 13px;
    padding: 8px 0;
    top: -10px;
  }
}

Important Notes

  • This method is CSS-only, meaning you cannot add links, styling, or dynamic content inside the message.

  • For more advanced functionality (dismiss button, clickable CTA, etc.), it's better to use HTML injection + CSS.

Final Thoughts

Using: before on .header-nav is a fast and simple way to add a non-interactive announcement above your menu in Squarespace 7.1. It’s best suited for:

  • Static promotions

  • Limited-time offers

  • Visual notices that don’t require clicks or interaction

Need more flexibility? Consider combining HTML code injection with custom CSS for full control.


Frequently Asked Questions

Walid Hasan

I'm a Professional Web developer and Certified Squarespace Expert. I have designed 1500+ Squarespace websites in the last 10 years for my clients all over the world with 100% satisfaction. I'm able to develop websites and custom modules with a high level of complexity.

If you need a website for your business, just reach out to me. We'll schedule a call to discuss this further :)

https://www.squareko.com/
Previous
Previous

How to Fix Horizontal Scroll on Desktop and Mobile in Squarespace

Next
Next

Why Is the Squarespace Editor So Slow? (How to Fix It)