有谁知道如何使用 CSS 通过 xlink:href
属性选择 XML 元素?
参见 here用法,但是它没有解释如何使用 CSS 选择它。
<book title="XQuery Kick Start">
<description
xlink:type="simple"
xlink:href="http://book.com/images/XQuery.gif"
xlink:show="new"> ... </description>
</book>
最佳答案
使用 CSS attribute selectors , 你需要 escape the colon :
前导反斜杠\
,如下:
description[xlink\:href="http://book.com/images/HPotter.gif"] {
background-color: gold;
}
<?xml version="1.0" encoding="UTF-8"?>
<bookstore xmlns:xlink="http://www.w3.org/1999/xlink">
<book title="Harry Potter">
<description
xlink:type="simple"
xlink:href="http://book.com/images/HPotter.gif"
xlink:show="new"> ... </description>
</book>
<book title="XQuery Kick Start">
<description
xlink:type="simple"
xlink:href="http://book.com/images/XQuery.gif"
xlink:show="new"> ... </description>
</book>
</bookstore>
关于html - 如何通过 xlink :href attribute with CSS? 选择 XML 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21950703/