我想对html中的<rect>
元素应用stripe模式,但看起来该模式没有被应用。
.green-class {
fill: green;
height: 40px;
mask: url(#mask-stripe) !important
}
<svg class="availability-time-line-graphic" id="uptime-component-dbl6mg39xr0j" preserveAspectRatio="none" height="34" viewBox="150 0 298 34"><defs>
<pattern id="pattern-stripe" width="4" height="4" patternunits="userSpaceOnUse" patterntransform="rotate(45)">
<rect width="2" height="4" transform="translate(0,0)" fill="white"></rect>
</pattern>
<mask id="mask-stripe">
<rect x="0" y="0" width="100%" height="100%" fill="url(#pattern-stripe)">
</rect></mask>
</defs>
<rect height="34" width="3" x="440" y="0" fill="#2fcc66" class="uptime-day component-dbl6mg39xr0j day-88 green-class" data-html="true"></rect>
<rect height="34" width="3" x="445" y="0" fill="#2fcc66" class="uptime-day component-dbl6mg39xr0j day-89 green-class" data-html="true"></rect>
</svg>
1条答案
按热度按时间zwghvu4y1#
如果在
<pattern>
上设置viewBox属性,则更容易控制模式。我还改变了
<svg>
上的viewBox以及<rect>
的位置和大小。