- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I have an unordered list of social icons. I want to style each one differently. I just revisited this article https://css-tricks.com/attribute-selectors. It uses the a[href] attribute selector to style each link. Is this still the best practice? Or should I use jQuery to add a new class to each link and target the class instead?
Best practice….that’s arguable.
There are many ways to target elements, manually adding classes, by attribute, Jquery and the like.
What you use and when will depend on the project and the amount of work required.
Thanks for the reply Paulie_D. I’m using a CMS, so I can’t manually add classes.
In terms of page load, looks like calling classes are more efficient. Would you agree?
It seems to defeat the purpose if I have to write extra code just to create the classes.
I’m using a CMS, so I can’t manually add classes.
What CMS is that?
Drupal. “Can’t” was probably a poor word to use since I’m sure it’s possible in a preprocess function. But do I want to bother?