Skip to content Skip to sidebar Skip to footer

Do Css Namespace Attribute Selectors Work With Xhtml/html Elements?

I want to style elements with xlink:href attribute in a XHTML, however I can't make it work. My test code:

Solution 1:

They do. You've just set up either your markup or your CSS rules incorrectly.

Your attribute selectors are looking for elements with href attributes (in the respective namespaces), but your <p> elements have xref attributes, not href attributes, so they don't match.

Your <xyz:p> and <xyz> elements on the other hand all have href attributes, so those are the ones that end up matching your attribute selectors instead.

Post a Comment for "Do Css Namespace Attribute Selectors Work With Xhtml/html Elements?"