Pokemon123
V2EX  ›  问与答

怎么给 SVG 图形加一个贴合自身形状的 border,或者是贴合自身大小的方形?

  •  
  •   Pokemon123 · Oct 13, 2020 · 1577 views
    This topic created in 2045 days ago, the information mentioned may be changed or developed.
    3 replies    2020-10-14 14:13:26 +08:00
    ysc3839
        1
    ysc3839  
       Oct 13, 2020 via Android
    把 SVG 发来看看?
    Pokemon123
        2
    Pokemon123  
    OP
       Oct 14, 2020
    @ysc3839
    <svg id="svg-wrap" width="600" height="600" viewBox="0 0 600 600">
    <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180" stroke="green" fill="transparent" stroke-width="5" my-attr="3" />
    <ellipse cx="200" cy="200" rx="50" ry="20" my-attr="1" class="demo"/>
    </svg>
    ysc3839
        3
    ysc3839  
       Oct 14, 2020 via Android
    @Pokemon123 如果只有 path 的话还好搞,有别的形状就更复杂了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1030 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 19:02 · PVG 03:02 · LAX 12:02 · JFK 15:02
    ♥ Do have faith in what you're doing.