Link to home
Start Free TrialLog in
Avatar of gkluk
gklukFlag for United Kingdom of Great Britain and Northern Ireland

asked on

CSS selector for a "pattern-matching" like expression

Is there a way in CSS that you can specify that states that if you have an anchor tag followed by text or not an image tag, then the link text should be made bold and have a background colour but if there is anything "inside" the anchor then nothing should happen? So if we have <a href="www.google.com">Google</a> Google should be bold and in a dark blue background colour, but if we have <a href="www.google.com"><img src="google.png"></a>, nothing should happen?
ASKER CERTIFIED SOLUTION
Avatar of Brandon Lyon
Brandon Lyon

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gkluk

ASKER

The problem with this is that I intended it to be a generic style applied on all webpages so I wouldn't know in advance what the layout is. If I just use the CSS rule for the anchor tag and the link has an image rather than text then the whole image becomes a blue mass once you hover over it which is obviously not desirable. Is the verdict then that this is not possible unless you know exactly what the layout of the page is and then you write CSS rules for this specific layout?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial