問題:
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