问题:
I want to place some SVG images before some selected elements.我想在某些选定元素之前放置一些 SVG 图像。 I am using jQuery but that is irrelevant.我正在使用 jQuery,但这无关紧要。
I would like to have the ::before
element to be as:我希望::before
元素为:
#mydiv::before {
content: '<svg ... code here</svg>';
display: block;
width: 22px;
height: 10px;
margin: 10px 5px 0 10px;
}
If I do it as shown above, it just display the string.如果我如上所示执行此操作,它只会显示字符串。 I checked the specs and there seems to be some restrictions on what content can be.我检查了规格,似乎对可以包含的内容有一些限制。 Is there a work around to this restriction?是否有解决此限制的方法? Only CSS content
is relevant to my question.只有 CSS content
与我的问题相关。
解决方案:
参考一: https://en.stackoom.com/question/1InBI参考二: https://stackoom.com/question/1InBI