Check out a free preview of the full Introduction to CSS course:
The "Pseudo-Classes Q&A" Lesson is part of the full, Introduction to CSS course featured in this preview video. Here's what you'd learn in this lesson's course:

Jen answers questions regarding pseudo-classes.

Get Unlimited Access Now

Transcript from the "Pseudo-Classes Q&A" Lesson

>> Jen Kramer: Yeah.
>> Speaker 2: Is it accurate too that, when I reference the class in the HTML file, I have to do that after the href and after the target, or it doesn't matter if I put it before the href?
>> Jen Kramer: Okay, so you're you're in the HTML, and you're talking about?

>> Speaker 2: When I create the class.
>> Jen Kramer: This line of code right here where you're linking to the stylesheet?
>> Speaker 2: No, when we created the class Harvard.
>> Jen Kramer: When we created the class Harvard, so we're in the CSS, uh-huh.
>> Speaker 2: Well, we have to put it into the HTML file too, right?

>> Jen Kramer: Right, and then we need to add it to the HTML.
>> Speaker 2: Yeah, when I add it into the HTML, does it need to be after the href?
>> Jen Kramer: No, so these attributes here, in our tag, these attributes, in the case of this a tag, we have href, target, and class, all three of those, they can be in any order.

We can change them to whatever order you want, HTML doesn't care.
>> Jen Kramer: Other questions? Yes.
>> Speaker 3: I missed that, and when we're using the extra classes, they have to be in a certain order?
>> Jen Kramer: They do have to be in a certain order, yes.
>> Speaker 3: So does that mean you can't leave any out?

>> Jen Kramer: You can't absolutely leave them out. I could leave out this visited link, just like that. So now I've only styled my unvisited links in my hover state, but those need to be in that exact order, yeah. So this is addressed in your notes.
>> Jen Kramer: There we go.

This is addressed in your notes. Any time you're working with these pseudo classes, like link, visited, hover, active, and focus, they need to go in a very specific order. And that is rememberable by the acronym Lord Vader Former Handle Anakin, so, link visited FHA. So F is for focus, that has to do mostly with touch devices, but LVHA.

The other one, we had LVHA for many years before focus came along, and I told people to live happy. That's another one you can think of, live happy. But now with focus that comes in the middle. So Lord Vader Former Handle Anakin. Yay Star Wars. Yes, Jenna?
>> Speaker 3: Only for a tags or, when you're using them on anywhere?

>> Jen Kramer: Anywhere, any time you're using those pseudo classes. In order for the cascade to work correctly, you'll want them in that order.