Search code examples
htmlcsstexthyperlink

CSS Style a specific link


Scenario: I am in the process of creating a website for the company I work for. I need to follow their visual style guide so I'm creating a CSS file for the website.

Question: All the "more" links need to be in 11pt font while the body is in 12pt. Is there a way to specify that if the link is "more" that it will be styled in 11pt?

Edit: Is there anyway to do this without using a class? Based off the text instead?

Summary: I need to style specific links but I would not like to use classes to style them, maybe text instead?


Solution

  • HTML

    <a href="whatever.html" class="more">More</a>
    

    CSS

    body {
        font-size: 12px;
    }
    
    a.more {
        font-size: 11px;
    }