user318197
user318197

Reputation: 333

Prevent anchor tag from inheriting CSS styles

I'm creating a set of anchor tags in a LI dynamically in a DIV. But I see that all these anchor tags are inheriting it's styles from the default anchor tags that are in the parent DIV. Can any one please tell me how to prevent these anchor tags from inheriting it's style from the default anchor tag? Thanks.

Upvotes: 1

Views: 1109

Answers (1)

Rick Donohoe
Rick Donohoe

Reputation: 7271

Your problem maybe something to do with inheritance. I'd suggest the following to try:

  1. Reference these anchors with greater detail:

    div ul li a.class_name

    div ul li a#id_name

  2. Apply styles only to that level using the > selector:

    li > a

in this situation means only apply it to anchor which are direct children of the list element.

Is the style rules within the same stylesheet?

Upvotes: 2

Related Questions