Search code examples
htmlcsshyperlinkredditparagraph

Is there a way to limit CSS styling for a link to a <p> / paragraph?


Currently i'm trying to overhaul a reddit page and i'm struggling to style multiple links in the sidebar. Is it possible to style links in a paragraph without a class? If not are there any other possibilities as i can't seem to find any except having multiple images.

<p>
<a href="#">Only links in this paragraph will be styled.</a>
</p>


Solution

  • Is this what you are looking for?

    p a {
      color: red;
    }
    

    You might need to add an !important to the properties you are trying to override.