简体   繁体   English

改变圆形svg内的笔画宽度

[英]change stroke-width inside a circular svg

Trying to change stroke-width of paths inside a svg . 试图改变svg内部paths stroke-width

Both paths should be 9 instead of 3 and 5 . 两条路径应该是9而不是35

As a result I'm getting deformed (not circular) paths. 结果我变形(非圆形)路径。

Any help and a short explaination, pls. 任何帮助和简短的解释,请。

 .single{ width:120px; height:120px; } 
 <div class="single"> <svg viewBox="0 0 100 100" style="display: block; width: 100%;"><path d="M 50,50 m 0,-47.5 a 47.5,47.5 0 1 1 0,95 a 47.5,47.5 0 1 1 0,-95" stroke="#4598C9" stroke-width="3" fill-opacity="0"></path> <path d="M 50,50 m 0,-47.5 a 47.5,47.5 0 1 1 0,95 a 47.5,47.5 0 1 1 0,-95" stroke="#dd4b39" stroke-width="5" fill-opacity="0" class = "xpath" style="stroke-dasharray: 300, 300; stroke-dashoffset: 255;"></path></svg> </div> 

Your shape is bigger than the viewBox if you make the stroke-width larger. 如果使笔划宽度更大,则您的形状比viewBox大。 One way to fix that is to change the viewBox sizing so the shape appears a little smaller and fits in the drawing area. 解决这个问题的一种方法是更改​​viewBox大小,使形状看起来更小,并且适合绘图区域。

 .single{ width:120px; height:120px; } 
 <div class="single"> <svg viewBox="-3 -3 106 106" style="display: block; width: 100%;"><path d="M 50,50 m 0,-47.5 a 47.5,47.5 0 1 1 0,95 a 47.5,47.5 0 1 1 0,-95" stroke="#4598C9" stroke-width="9" fill-opacity="0"></path> <path d="M 50,50 m 0,-47.5 a 47.5,47.5 0 1 1 0,95 a 47.5,47.5 0 1 1 0,-95" stroke="#dd4b39" stroke-width="9" fill-opacity="0" class = "xpath" style="stroke-dasharray: 300, 300; stroke-dashoffset: 255;"></path></svg> </div> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM