W3验证引发了以下错误: -
Element stop is missing required attribute offset
在此代码上: -
<!-- Defining Angle Gradient Colors -->
<svg width="0" height="0">
<defs>
<!-- Colours red #ca3b37 gold #f0a635 blue #4fc4f6 green #0FBD46-->
<linearGradient id="cl1" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="1" y2="1">
<stop stop-color="#ca3b37"/>
<stop offset="100%" stop-color="#ca3b37"/>
</linearGradient>
<linearGradient id="cl2" gradientUnits="objectBoundingBox" x1="0" y1="0" x2="0" y2="1">
<stop stop-color="#ca3b37"/>
<stop offset="100%" stop-color="#f0a635"/>
</linearGradient>
<linearGradient id="cl3" gradientUnits="objectBoundingBox" x1="1" y1="0" x2="0" y2="1">
<stop stop-color="#f0a635"/>
<stop offset="100%" stop-color="#4fc4f6"/>
</linearGradient>
<linearGradient id="cl4" gradientUnits="objectBoundingBox" x1="1" y1="1" x2="0" y2="0">
<stop stop-color="#4fc4f6"/>
<stop offset="100%" stop-color="#4fc4f6"/>
</linearGradient>
<linearGradient id="cl5" gradientUnits="objectBoundingBox" x1="0" y1="1" x2="0" y2="0">
<stop stop-color="#4fc4f6"/>
<stop offset="100%" stop-color="#0FBD46"/>
</linearGradient>
<linearGradient id="cl6" gradientUnits="objectBoundingBox" x1="0" y1="1" x2="1" y2="0">
<stop stop-color="#0FBD46"/>
<stop offset="100%" stop-color="#0FBD46"/>
</linearGradient>
</defs>
</svg>
任何人都可以告知缺少的属性是什么/如何应用。
由于
Glennyboy
答案 0 :(得分:1)
某些stop元素在您的示例中有一个offset属性,有些则没有。您需要为所有不匹配的属性添加偏移属性。
<stop stop-color="#ca3b37"/>
<stop offset="100%" stop-color="#ca3b37"/>
变为
<stop offset="<some value you need to decide on>" stop-color="#ca3b37"/>
<stop offset="100%" stop-color="#ca3b37"/>
你替换&lt;你需要决定的某个值&gt;有一个值,也许是0。