Do CSS namespace attribute selectors work with XHTML/HTML elements?

前端 未结 1 1218
猫巷女王i
猫巷女王i 2020-12-21 01:51

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




        
1条回答
  •  北海茫月
    2020-12-21 02:36

    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

    elements have xref attributes, not href attributes, so they don't match.

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

    0 讨论(0)
提交回复
热议问题