2017-10-25 9 views

答えて

0

Welp、私は私の答えを持っている

https://jsfiddle.net/oegmc7xt/

htmlの推測:

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" width="200px"> 
    <rect fill="#444444" width="200" height="200"></rect> 
    <rect fill="#abcdef" width="100" height="100" class="move"></rect> 
</svg> 


<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 200 200" enable-background="new 0 0 200 200" xml:space="preserve" width="100px"> 
    <rect fill="#444444" width="200" height="200"></rect> 
    <rect fill="#abcdef" width="100" height="100" class="move"></rect> 
</svg> 

CSS: "は50px" は50のSVGユニット

にスケーリングされるように

.move { 
    transform: translateX(50px) 
} 

はそう

+0

さらに、[userspace coordinates](https://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace)にあります。つまり、複数のトランスフォームがSVGの内部にネストされている場合や、新しいビューポートがviewBox属性で設定されている場合、ユニットは座標系を変換する次の親に対して要素の座標で表されます。 – ccprog

関連する問題