请注意,我这里不使用CSS。我想知道如何在我的html代码(内联XML)中居中svg。
这是代码(我从free iconfinder.com获得了图标):
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN''http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
<svg enable-background="new 0 0 512 512" id="Layer_1" version="1.1" viewBox="0 0 512 512" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100px" height="100px"><path d="M488.8,230.3h-7.2C471.4,140,408,65.6,323.6,39.2c-6.8-11.2-11.4-17.4-11.7-17.7c-13.9-17-31.3-8.9-37.2,8.2 c-6.1-0.5-12.3-0.8-18.6-0.8s-12.5,0.3-18.6,0.8c-5.9-17.1-23.3-25.2-37.2-8.2c-0.3,0.4-4.9,6.5-11.7,17.7 C104,65.6,40.6,140,30.4,230.3h-7.2c-12.7,0-23.1,10.4-23.1,23.1v5.1c0,12.7,10.4,23.1,23.1,23.1h7.2 c10.2,90.5,73.8,165,158.5,191.2c3.4,5.9,6.9,11.8,10.6,17.7c12.8,17,32.8,8.4,39.7-8.2c5.5,0.4,11.1,0.6,16.8,0.6 s11.2-0.2,16.8-0.6c6.9,16.6,27,25.2,39.7,8.2c3.7-5.9,7.2-11.8,10.6-17.7c84.6-26.2,148.2-100.8,158.5-191.2h7.2 c12.7,0,23.1-10.4,23.1-23.1v-5.1C511.9,240.7,501.5,230.3,488.8,230.3z M436.3,230.3h-53.2c-3.1-49.9-15-93.2-28.2-127.2 C398.1,131.2,428.8,177.1,436.3,230.3z M286.5,76.5c15.1,24.2,44,79.4,49.1,153.9H176.3c5.1-74.5,34-129.7,49.1-153.9 c9.9-1.7,20.1-2.6,30.5-2.6S276.6,74.8,286.5,76.5z M157.2,103.1c-13.2,34-25.2,77.3-28.2,127.2H75.7 C83.2,177.1,113.9,131.2,157.2,103.1z M75.7,281.7H129c2.6,39.8,11.3,82.8,29.2,127.9C114.4,381.6,83.3,335.3,75.7,281.7z M226.4,435.7c-31.4-55.3-45.6-107.4-49.6-154h158.5c-4,46.7-18.2,98.7-49.6,154c-9.6,1.6-19.5,2.4-29.6,2.4S236,437.3,226.4,435.7z M353.8,409.6c17.9-45.1,26.6-88.1,29.2-127.9h53.3C428.7,335.3,397.6,381.6,353.8,409.6z" fill="#303A3F"/>
</svg>
谢谢!