Jump to content

Style paragraph link within code block

Recommended Posts

Site URL: https://life-of-charlie.squarespace.com/blog/game-changing-skincare

I've used custom CSS to implement a drop cap on the first letter of the first paragraph of a blog post. To do so, I applied a class to the entire first block of text using a code block, up until the first non-text element (an image, in this case), to prevent inconsistent spacing between paragraphs (code blocks have a bit more padding).

However, it appears that links within the text in that code block are not inheriting the same styling as all other links. Is there an issue with how I've created the link? Or a way to force 

p a {}

elements within a code block to inherit Squarespace's default link styling via CSS?


Site is currently password-protected, use code buildout.


Blog drop cap no link styling.png

Code block HTML 2.png

Code block HTML 1.png

Blog text with proper link styling.png

Link to comment
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thank you for that! For others' reference, I used the following

.blog-item-wrapper .blog-item-content p a {
  color: @accent;
  background-repeat: repeat-x;
  background-image: linear-gradient(to right,currentColor 180%,currentColor 0);
  background-size: 1px 1px;
  background-position: 0 100%;
  white-space: initial;

to override all link styling in the blog post paragraphs, regardless of whether or not they were within the code block. In this case, @accent is assigned to the hex code of my palette accent color.


Link to comment
  • 9 months later...

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.