From the course: HTML and CSS: Linking

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Making exceptions to link styling

Making exceptions to link styling

From the course: HTML and CSS: Linking

Start my 1-month free trial

Making exceptions to link styling

- [Instructor] In our last video, we styled all of the possible states for our links individually, as a group. Now, maybe we want to style the Harvard link slightly differently than the LinkedIn link. There's a lot of possibilities for selectors to write this, but let's do what most people would do, most commonly, which is to add a class to the link, and then style accordingly. So here inside of the HTML, I'm going to click inside of the tag here on line three, and I'm going to add a class of Harvard, because what else would we do? And then down here inside of my CSS these are generic styles for all of the links on the page. After all of that, I am going to put in my Harvard styling and I'm going to say that the color will be crimson, of course, and the font weight will be bold. OK, so we have a bold link, but the link itself is still green. It didn't turn crimson. So what exactly is going on? It's a class. We put it at the end of the style sheet. So why isn't it overriding the more…

Contents