There are going to be situations where you need to be able to target elements based on specific data associated with those elements. Or, target elements based on specific attributes that they have.
Know what this means? It means all the methods you’ve previously learned about selecting and styling elements (classes, IDs, programmatic selection with pseudo-classes, etc.) will all fail you in these situations.
So, there’s one more technique that you need to learn: data attributes. And along with that, we need to talk about how the attribute selector works. I’ll even show you some incredible superpowers that come along with the attribute selector.
That’s not all, though. You’ll also learn how to display data from data attributes using the attr() function and get a glimpse of how data attributes empower more efficient JS interactions in web design.
It’s another packed training session that’s going to greatly elevate you above beginner/intermediate level.
Enjoy!