Grow your CSS skills. Land your dream job.

Class conflict?

  • # April 11, 2008 at 10:47 am

    Hi everyone,

    Is it improper to give a single class conflicting properties based on the parent element? I know this "works" but I’m wondering if it’s considered poor practice.

    (I realize in this example you could just remove the li class and define them as "ul.groceries li", but assume the li class is necessary, for instance if we had to define multiple line items)

    Thanks!
    A.S.

    Code:
    • Milk
    • Honey
    • Muffler
    • Tire
    # April 11, 2008 at 4:17 pm

    That’s totally fine. There’s no conflict because in the CSS you’ve defined different parent elements.

    # April 11, 2008 at 6:50 pm

    I agree with daGUY on this—your code looks and is fine (besides the unnecessary li class, of course, but you said you need that).

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".