Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Style paragraph link within code block


gclarke

Question

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.

Thanks!

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 post
  • Answers 2
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

Posted Images

2 answers to this question

Recommended Posts

  • 1

The reason is due to CSS specificity. See screenshot. To override you could use a higher specificity using the following CSS:

.blog-item-wrapper .blog-item-content p a {
  /* add css here to override */
}

 

Game-Changing_Skincare_—_life_of_charlie.png

Link to post
  • 0

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 post

Create an account or sign in to comment

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


×
×
  • Create New...