admin管理员组文章数量:1122846
I want to insert svg code in a Guttenberg HTML block. I don't want it as an image because I want to manipulate it with CSS. If I insert svg, all tag diseappears and I have only the text which was inside svg tags. Thanks.
I want to insert svg code in a Guttenberg HTML block. I don't want it as an image because I want to manipulate it with CSS. If I insert svg, all tag diseappears and I have only the text which was inside svg tags. Thanks.
Share Improve this question asked Oct 18, 2019 at 8:07 AlyskoAlysko 1363 bronze badges2 Answers
Reset to default 2I tried this code on a clean install of WordPress
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg>
and used 'Custom HTML' in Guttenberg in a new post. This worked fine for me.
The same code displayed in the DOM without deleting any tags or adding any
Maybe you cant edit the SVG with HTML because WordpPress doesn't generate the code until the page is called.
0
What you want to do, is use the wordpress gutenberg own SVG Component
import { G, Path, SVG, Rect, Polygon } from '@wordpress/components';
<svg strokeLinecap={ "round" }/>
本文标签: Insert SVG code (not img) in HTML block
版权声明:本文标题:Insert SVG code (not img) in HTML block 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736287917a1927984.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论