我有一個簡單的svg圖標,我正在使用。我已將它的高度和寬度設置爲16px。當我檢查svg元素時,它是16px。但是,它看起來比它需要分組的其他圖標稍小。路徑沒有填充完整的SVG元素大小
當我檢查svg中唯一的'路徑'時,它的大小是15.625px。
下面是SVG:
<svg height="16px" style="enable-background:new 0 0 512 512;"
version="1.1" viewBox="0 0 512 512" width="16px" xml:space="preserve"
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path d="M456,506H56c-27.617,0-50-22.393-50-50V56 C6,28.383,28.383,6,56,6h400c27.618,0,50,22.383,50,50v400C506,483.607,483.618,506,456,506z M214.213,259.408 c0-0.762-0.195-1.475-0.224-2.227l98.73-54.814c9.649,8.135,21.953,13.232,35.576,13.232c30.655,0,55.498-24.843,55.498-55.488 c0-30.654-24.843-55.498-55.498-55.498c-30.654,0-55.498,24.844-55.498,55.498c0,2.832,0.43,5.557,0.84,8.272l-94.922,52.705 c-10.097-10.537-24.248-17.168-40-17.168c-30.644,0-55.488,24.844-55.488,55.488c0,30.654,24.844,55.498,55.488,55.498 c15.264,0,29.073-6.172,39.102-16.142l95.176,52.851c1.035,29.736,25.312,53.565,55.302,53.565 c30.655,0,55.498-24.844,55.498-55.499c0-30.644-24.843-55.488-55.498-55.488c-17.08,0-32.177,7.891-42.353,20.03l-92.1-51.133 C213.93,261.849,214.213,260.668,214.213,259.408z" id="share_1_" style="fill-rule:evenodd;clip-rule:evenodd;fill:grey;"/>
</svg>
如何使路徑元素是大小是其中所包含的SVG元素一樣嗎?
即。如果svg是16px * 16px,那麼路徑應該是16px * 16px - 而不是15.625px * 15.625px。
原諒我,如果這是一個愚蠢的問題,但我是一個總的SVG新手....
你可以在這裏看到它在一個plnkr: http://plnkr.co/edit/0XBHg89HbUoPdDL22GSF
調整viewBox參數以使內容顯得更大或更小。 –