2013-12-12 69 views
1

在IE9中使用小型svg時出現問題。它得到的右側剁掉/不集中:IE9中的SVG縮放問題

screenshot(應該是一個 「X」)

我的SVG:

<?xml version="1.0" encoding="utf-8"?> 
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> 
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" 
    viewBox="0 0 364.786 364.786" enable-background="new 0 0 364.786 364.786" 
    xml:space="preserve" preserveAspectRatio="xMinYMin none"> 
<polygon fill="#999999" points="300.988,0 182.388,118.618 63.768,0.015 0,63.745 118.639,182.376 0.015,301.018 63.745,364.786 
    182.395,246.127 301.045,364.771 364.786,300.988 246.15,182.371 364.771,63.742 "/> 
</svg> 

我刪除寬度高度和have viewbox and preserveAspectRatio =「xMinYMin none」雖然...

http://jsfiddle.net/dzCL2/12/

回答

2

你preserveAspectRatio值是無效的,應該被瀏覽器所忽略:

preserveAspectRatio="xMinYMin none" 

xMidYMid meet的默認值將在這種情況下渲染時使用。

有關語法的詳細信息,請參閱SVG 1.1 spec。 IE可能會將該值視爲部分有效,僅應用xMinYMin部件,這會導致左對齊的圖像。使用正確的語法應該有希望解決這個問題。

+0

太棒了!工作......我從這裏複製了無效值:http://stackoverflow.com/a/11780399/395035 – acy

0

這爲我工作在Safari避免比例縮放正確的設置:

<svg ... preserveAspectRatio="none"> 

</svg>