Svg矩形回合外观取决于其位置

问题描述 投票:0回答:1

enter image description here

我为所有矩形设置rx =“ 3” ry =“ 5”,但外观不同取决于缩放比例100%,为什么?有任何想法吗?

顶部:

<rect x="217.5" y="-8" style="fill:white;stroke-width:1;stroke:rgb(0,0,0)" 
width="45px" height="27px" rx="3" ry="5">
</rect>
<rect x="167.5" y="-8" viewBox="0 0 100 100" rx="3" ry="5" 
style="fill:white;stroke-width:1;stroke:rgb(0,0,0)" width="45px" height="27px">
</rect>

右:

<rect rx="3" ry="5" x="356" y="73" style="fill:white;stroke-width:1;stroke:rgb(0,0,0)" 
width="45px" height="27px" viewBox="0 0 100 100"></rect>
html css svg
1个回答
0
投票

我使用<foreignObject>解决了此问题

<foreignObject x="356" y="73" width="50px" height="40px">
    <div style="background-color:white; width:45px; height:27px; border-radius:4px; border:1px solid black;"></div>
</foreignObject>
© www.soinside.com 2019 - 2024. All rights reserved.