Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Attributes or jQuery – What's the best practice styling links?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #162728
    cannanso
    Participant

    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?

    #162741
    Paulie_D
    Member

    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.

    #162760
    cannanso
    Participant

    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.

    #162762
    chrisburton
    Participant

    I’m using a CMS, so I can’t manually add classes.

    What CMS is that?

    #162774
    cannanso
    Participant

    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?

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Other’ is closed to new topics and replies.