문제

This is the file i have.

<svg
   width="700"
   height="500">
  <g
     id="layer1">
    <text
       style="font-size:100%;font-family:Bitstream Vera Sans"
       x="6"
       y="37"
       id="">TEST</text>
  </g>
</svg>

i want TEST to automatically occupy the whole thing somehow. like 100% kind of a thing.

right now the text is miss-alligned due to x and y ordinates.

도움이 되었습니까?

해결책

Try setting the viewBox instead of a specific width and height:

<svg viewBox="0 0 240 70">
  <g id="layer1">
    <text
       style="font-size:100px;font-family:Bitstream Vera Sans"
       x="0"
       y="70"
       id="">TEST</text>
  </g>
</svg>

Note that Chrome has some rendering inconsistencies with SVG with no specific height.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top