stroke-width
        
        
          
                Baseline
                
                  Widely available
                
                
              
        
        
        
          
                
              
                
              
                
              
        
        
      
      This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年3月.
stroke-width 表现属性定义了应用于图形的外轮廓的宽度。
你可以将此属性与以下 SVG 元素一起使用:
示例
html
<svg viewBox="0 0 30 10" xmlns="http://www.w3.org/2000/svg">
  <!-- 默认外轮廓宽度为 1 -->
  <circle cx="5" cy="5" r="3" stroke="green" />
  <!-- 使用数值设置外轮廓宽度 -->
  <circle cx="15" cy="5" r="3" stroke="green" stroke-width="3" />
  <!-- 使用百分数设置外轮廓宽度 -->
  <circle cx="25" cy="5" r="3" stroke="green" stroke-width="2%" />
</svg>
使用说明
| 值 | <length> | <percentage> | 
|---|---|
| 默认值 | 1px | 
    
| 动画性 | 是 | 
备注:百分数值始终以标准化 viewBox 的对角线长度的百分比计算。
规范
| Specification | 
|---|
| Scalable Vector Graphics (SVG) 2> # StrokeWidth>  | 
            
浏览器兼容性
Loading…