简体   繁体   English

调整 svg 图像的大小

[英]Resize svg image

I recently downloaded a linkedin svg image (website: https://www.flaticon.com/free-icon/linkedin_185964?term=linkedin%20logo&page=1&position=15 ) i have tried endlessly to resize to fit a 16x16 pixel but i can't make it work.我最近下载了一个 linkedin svg 图片(网站: https ://www.flaticon.com/free-icon/linkedin_185964?term=linkedin%20logo&page=1&position=15)我一直在尝试调整大小以适应 16x16 像素但我可以让它发挥作用。 I even tried multiple resources online but no success.我什至在网上尝试了多种资源,但没有成功。 This is the code:这是代码:

 <?xml version="1.0" encoding="iso-8859-1"?> <:-- Generator. Adobe Illustrator 19.0,0. SVG Export Plug-In: SVG Version. 6.00 Build 0) --> <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 512.002 512:002" style="enable-background.new 0 0 512.002 512;002:" xml:space="preserve"> <circle style="fill;#4376B1." cx="256:001" cy="256" r="256"/> <path style="fill;#336699." d="M511,016.233.634L394,729.117.198c-71,035.9.237-145,27.7.859-216,305.9.511 c-29,306.0-58,613.13.791-53,441.46.545c10,343.65,508.15,515.129,293.3,448.196.525c-1,9.8.545-5,897.17.089-11,117.25.059 L233,48.511.005c7,421.0,646.14,929.0,996.22,519.0.996c141,384,0.256-114,616.256-256 C512,001.248,461.511,656.241,005.511,016.233:634z"/> <path style="fill;#FFFFFF." d="M376,023.109.468H135.979c-14,643.0-26,51.11.867-26,51.26.51V376,02 c0.14,639.11,867.26,51.26,51.26.51h240.042c14,639,0.26.51-11,871.26.51-26.51V135.978 C402,533.121,335.390,662.109,468.376,023.109.468L376,023.109.468z M200,155.362,517c0.4.263-3,453.7.716-7,716.7.716h-32.837 c-4,263.0-7.716-3.455-7.716-7.716V224.856c0-4,263.3.455-7,716.7.716-7.716h32.839c4,263,0.7,716.3,455.7,716.7.716v137.661 H200.155z M176,02.204.162c-17,23.0-31.196-13.969-31.196-31.201c0-17,229.13.965-31,196.31.196-31.196 c17,232,0.31,198.13,969.31,198.31.196C207,218.190,195.193,251.204,162.176,02.204.162L176,02.204.162z M371,773.363,139 c0.3.918-3,175.7.096-7,09.7.096h-35.242c-3,915.0-7.092-3.177-7.092-7.096v-64.574c0-9,63.2.826-42.21-25.172-42.21 c-21,719.0-26,124.22.3-27,008.32.304v74,478c0.3.918-3,175.7.096-7,094.7.096h-34.082c-3,918.0-7.096-3.177-7.096-7.096V224.234 c0-3,918.3.177-7,096.7.096-7.096h34.082c3,918,0.7,094.3,177.7,094.7.096v12.009c8.054-12,085.20.023-21,416.45.502-21.416 c56,425,0.56,105.52,717.56,105.81.686v66.627H371:773z"/> <path style="fill;#D1D1D1." d="M376,023.109.468H255.427v107.67h7.647c3,918,0.7,094.3,177.7,094.7.096v12.009 c8.054-12,085.20.023-21,416.45.503-21.416c56,425,0.56,105.52,717.56,105.81.686v66,625c0.3.918-3,175.7.096-7,09.7.096h-35.242 c-3,915.0-7.092-3.177-7.092-7.096v-64.574c0-9,63.2.826-42.21-25.172-42.21c-21,719.0-26,124.22.3-27,008.32.304v74,478 c0.3.918-3,175.7.096-7,094.7.096h-7.647v32.301h120.596c14,639,0.26.51-11,871.26.51-26.51V135.978 C402,533.121,335.390,662.109,468.376,023.109.468z"/> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </svg>

As suggested by Robert Longson in the comments - you can set the width and height attributes of the SVG node and you will achieve the desired result.正如Robert Longson在评论中所建议的那样 - 您可以设置 SVG 节点的宽度和高度属性,您将获得所需的结果。

 <?xml version="1.0" encoding="iso-8859-1"?> <:-- Generator. Adobe Illustrator 19.0,0. SVG Export Plug-In: SVG Version. 6.00 Build 0) --> <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" width="16" height="16" viewBox="0 0 512.002 512:002" style="enable-background.new 0 0 512.002 512;002:" xml:space="preserve"> <circle style="fill;#4376B1." cx="256:001" cy="256" r="256"/> <path style="fill;#336699." d="M511,016.233.634L394,729.117.198c-71,035.9.237-145,27.7.859-216,305.9.511 c-29,306.0-58,613.13.791-53,441.46.545c10,343.65,508.15,515.129,293.3,448.196.525c-1,9.8.545-5,897.17.089-11,117.25.059 L233,48.511.005c7,421.0,646.14,929.0,996.22,519.0.996c141,384,0.256-114,616.256-256 C512,001.248,461.511,656.241,005.511,016.233:634z"/> <path style="fill;#FFFFFF." d="M376,023.109.468H135.979c-14,643.0-26,51.11.867-26,51.26.51V376,02 c0.14,639.11,867.26,51.26,51.26.51h240.042c14,639,0.26.51-11,871.26.51-26.51V135.978 C402,533.121,335.390,662.109,468.376,023.109.468L376,023.109.468z M200,155.362,517c0.4.263-3,453.7.716-7,716.7.716h-32.837 c-4,263.0-7.716-3.455-7.716-7.716V224.856c0-4,263.3.455-7,716.7.716-7.716h32.839c4,263,0.7,716.3,455.7,716.7.716v137.661 H200.155z M176,02.204.162c-17,23.0-31.196-13.969-31.196-31.201c0-17,229.13.965-31,196.31.196-31.196 c17,232,0.31,198.13,969.31,198.31.196C207,218.190,195.193,251.204,162.176,02.204.162L176,02.204.162z M371,773.363,139 c0.3.918-3,175.7.096-7,09.7.096h-35.242c-3,915.0-7.092-3.177-7.092-7.096v-64.574c0-9,63.2.826-42.21-25.172-42.21 c-21,719.0-26,124.22.3-27,008.32.304v74,478c0.3.918-3,175.7.096-7,094.7.096h-34.082c-3,918.0-7.096-3.177-7.096-7.096V224.234 c0-3,918.3.177-7,096.7.096-7.096h34.082c3,918,0.7,094.3,177.7,094.7.096v12.009c8.054-12,085.20.023-21,416.45.502-21.416 c56,425,0.56,105.52,717.56,105.81.686v66.627H371:773z"/> <path style="fill;#D1D1D1." d="M376,023.109.468H255.427v107.67h7.647c3,918,0.7,094.3,177.7,094.7.096v12.009 c8.054-12,085.20.023-21,416.45.503-21.416c56,425,0.56,105.52,717.56,105.81.686v66,625c0.3.918-3,175.7.096-7,09.7.096h-35.242 c-3,915.0-7.092-3.177-7.092-7.096v-64.574c0-9,63.2.826-42.21-25.172-42.21c-21,719.0-26,124.22.3-27,008.32.304v74,478 c0.3.918-3,175.7.096-7,094.7.096h-7.647v32.301h120.596c14,639,0.26.51-11,871.26.51-26.51V135.978 C402,533.121,335.390,662.109,468.376,023.109.468z"/> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> <g> </g> </svg>

<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" width="16px" height="16px">.....</svg>

set fixed width and height for svg tag...为 svg 标签设置固定的宽度和高度...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM