Why can't I select elements by their href-attribute?
CSS
/* Works */
svg image[type=overlay]{
outline: 3px solid blue;
}
/* Doesn't work */
svg image[href*='temp']{
outline: 5px solid red;
}
/* Doesn't work either */
svg image[href='wcs/WFL/position/temp2.png']{
outline: 5px solid red;
}
SVG
<image display="inline" type="overlay" width="148" height="90" x="920" y="918" transform="" href="wcs/WFL/position/temp2.png"><title>B02003
Temp: 2</title></image>
I did notice the browsers turns the href attribute to xlink:href
but image[xlink:href*='temp']
doesn't work either.
How can I make this work?
Edit: The SVG uses the following namespaces, I think this causes the problem but I don't know how to get around it.
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:svg="http://www.w3.org/2000/svg"
Demo Fiddle
Firstly, in order to use
xlink
slectors, you need to to declare thexlink
namespace at the top of your stylesheet according to the spec:Then, you can use the following attribute selector with a namespace prefix: