As the CSS psuedo-selectors didn't seem up to the task, I went the route of having a class which excluded the :before
content where I didn't want it:
a:before {
content: "› "
}
a.no-before-content:before {
content: ""
}
Pergunta
a:before {
content: "› ";
}
a img:before {
content: ""
}
I know the above syntax is incorrect technically and semantically, but I want to exclude the content from the a tag any time an img is included within. Is this possible, or should I do it with a class instead, i.e.
a:before {
content: "> ";
}
a.no-before:before {
content: "";
}
I'd prefer to do it without having to define classes for it, but I can see that might be required.
I'd like to do this with only CSS, no JS involvement.
Solução 2
As the CSS psuedo-selectors didn't seem up to the task, I went the route of having a class which excluded the :before
content where I didn't want it:
a:before {
content: "› "
}
a.no-before-content:before {
content: ""
}
Outras dicas
I believe ur trying to achieve somthing as in this thread,pls check out. jQuery selectors: only link with images inside them
I think you cant do this using CSS3 , there is no has()
,no contains()
and no parent()
,they exists only in jQuery selectors.