Jump to content

Inject custom CSS for Header Titles

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

It is pretty hard to help you if I can not inspect your website and see the header's class name and other important detail.

You can inject text at the beginning of an element or at the end with CSS by using pseudo elements

#header:after {

    content: 'This is the OCA Studio main title on a page";

    font: 30px Arial, Verdana, sans-serif; 

}

This would go to your custom css panel.

But this is very bad for SEO especially that we are talking about Headings (h1-h6)

The second way would be to write a script into the Injections link > Footer panel

<script>

   const title = document.querySelector('#page h1');

   document.getElementById('header').appendChild(title);

</script>

So basically you moved a DOM element(h1) from one place to another. This is better for SEO then the first option. Of course your .header does not 

Jozsef Kerekes - Front-end developer and Squarespace enthusiast
My Blog: https://ui-workarounds.com
If you like my answer, please give me an upvote/like. Highly appreciated.

 

 

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.