SVG CSS验证错误:'属性填充不存在'

问题描述 投票:2回答:2

我已经创建了一个内联svg,但是css验证会出现错误(属性填充不存在:#6be300,属性笔划不存在:#1d1d1d,属性笔划宽度不存在:5px。)任何我知道我做错了什么?

 svg {
   height: auto;
   width: 50%;
 }
 rect {
   fill: #6be300;
   stroke: #1d1d1d;
   stroke-width: 5px;
 }
<svg width="400" height="400" xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 400 400">
  <title>blabla</title>
  <desc>blablabla</desc>

  <rect id="rect1" width="40" height="230" x="20" y="170" rx="10" />
  <rect id="rect2" width="40" height="300" x="60" y="100" rx="10" />
css svg css-validator
2个回答
4
投票

选择“更多选项”,然后在运行validator时选择包含SVG的配置文件。


-4
投票

解:

<rect id="rect1" fill: #6be300; width="40" height="230" x="20" y="170" rx="10" />
<rect id="rect2" stroke="#1d1d1d" width="40" height="300" x="60" y="100" rx="10" />

在内联css中使用该fill属性和值,并在外部css中删除。解决了!!!

© www.soinside.com 2019 - 2024. All rights reserved.