DEV Community

Alex Carpenter
Alex Carpenter

Posted on • Edited on

4

Style your default global links without affecting your component links

This is a little trick I've recently been implementing on any new projects. Style your default global links without affecting your component links.

a:not([class]) {
  color: #0055ff;
  text-decoration: none;

  &:hover,
  &:focus {
    text-decoration: underline;
  }
}

This helps prevent having to overwrite your global default link styles that you have applied within your component links.

Check out the demo below:

Top comments (1)

Collapse
 
bradbodine-dev profile image
Brad Bodine

Nice! Thanks for sharing. Sometimes these little things just get overlooked because we are busy thinking about the bigger things.

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay