Scenario : I want to be able to apply border css on the exact element on which I'm hovering, but whats happening is it applies the css on ts ancestral parents as well. [refer image]. I do not know the classes, or lets say the whole html structure beforehand, it is dynamic.
I have read other similar questions on stackoverflow as well but they don't match exactly to my scenario. Some say apply css on child when hover over parent
, some have classes known beforehand, etc.
But if anybody happens to know a link which points to the exact answer I need, pls do let me know.
Here you can see I'm pointing over the text 'Striped Ankle ...' but the hovering css also takes place over all the ancestral parents
The css I'm applying is
.root_div_class_name * :hover {
border: 1px solid #e42a78;
}
EDIT I am seeing a lot of people pointing out that the universal selector I am using is the cause of the problem, that it is applying the hover
property to all the tags in the web page. But could there be some misunderstanding bcoz I still don't see it as a problem.
I want the hover property applied on all the tags. It's just when I hover over a tag, I want to apply border only to that tag, not its parents.Border must be applied on the parent only when I hover over the parent.
EDIT Like I already mentioned, I am not creating the html. I already get the html therefore content is dynamic. I cannot further create siblings or change the structure, as suggested by the solution on the marked duplicate link. I have to make-do