在wordpress </svg>中使用html标签<svg>时无法显示svg

时间:2014-07-28 07:03:33

标签: javascript html wordpress svg

当我尝试在HTML5中使用SVG标签创建图像时,它似乎无法正常工作! 码: enter image description here
结果: enter image description here 的jsfiddle: enter image description here

原始代码:

 <svg  id="svg4"  width="165" height="85">
 <rect x="3" y="3" rx="20" ry="20"  width="160" height="80" style="fill:purple;stroke:black;stroke-width:5;opacity:1;">
 </svg>

任何人都可以帮我找一个插件或推荐一种方法让这个svg标签在WordPress中显示和Jsfiddle一样!

更新: 最后,我自己想出来了。

首先,禁用wordpress中的可视化编辑器。该过程是仪表板 - &gt;用户 - &gt;我的简历。然后单击复选框并选择禁用! 这样可以确保wordpress编辑器不会对svg标签进行条带化! enter image description here

之后,如果运行代码,它会显示: enter image description here

我们可以注意到编辑器将br标签添加到svg块中!神奇的是,如果我删除了br标签,它就可以了!显然,由于svg块中有换行符,编辑器会添加br标记!所以我删除了代码中的空格。然后我得到了这个! enter image description here

课程 - 如果出现异常情况,请仔细查看浏览器呈现的最终html代码!

===================更新==================== 几天前,我也遇到过类似的错误。编辑器中的css文件工作异常。

编辑器会自动添加

标签,让css失去功能 automatically add <p> tag and let css lose functionality

0 个答案:

没有答案