Html 如何使响应的SVG图像居中?

Html 如何使响应的SVG图像居中?,html,css,svg,Html,Css,Svg,我试图在SVG的容器中水平对齐SVG(在本例中,它可以是任何div、body或任何内容) 72 投资 30 成功的贸易销售 13 首次公开募股 同样的问题 默认情况下,SVG是内联的。添加display:block,然后margin:auto将按预期工作 72 投资 30 成功的贸易销售 13 首次公开募股 svg{ 显示:块; 保证金:0自动; 最大宽度:1320px; } 像这样的吗?请注意,图形当前未在视口中居中。这可能会扰乱“以人为中心”的观念。你能放弃投票吗 <svg xm

我试图在SVG的容器中水平对齐SVG(在本例中,它可以是任何div、body或任何内容)


72
投资
30
成功的贸易销售
13
首次公开募股
同样的问题

默认情况下,SVG是内联的。添加
display:block
,然后
margin:auto
将按预期工作


72
投资
30
成功的贸易销售
13
首次公开募股
svg{
显示:块;
保证金:0自动;
最大宽度:1320px;
}

像这样的吗?请注意,图形当前未在视口中居中。这可能会扰乱“以人为中心”的观念。你能放弃投票吗
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 868 190" preserveAspectRatio="xMidYMid slice" class="svg-content">
        <g fill="none" fill-rule="evenodd" transform="">
            <ellipse cx="442.5" cy="5.5" fill="#172A3A" rx="5.5" ry="5.5"></ellipse>
            <path stroke="#172A3A" d="M806.88 69.082v-4.68c0-12.692-10.29-22.98-22.982-22.98h-316.59c-9.558 0-18.64.828-24.868-6.422-6.228 7.25-15.31 6.42-24.87 6.42H100.983C88.29 41.42 78 51.71 78 64.403v4.68M442.5 11v55.5"></path>
            <ellipse cx="78.001" cy="113.501" fill="#743B41" rx="47.001" ry="47.501"></ellipse>
            <ellipse cx="443.001" cy="113.501" fill="#743B41" rx="47.001" ry="47.501"></ellipse>
            <ellipse cx="78.154" cy="113.54" fill="#172A3A" rx="36.154" ry="36.54"></ellipse>
            <ellipse cx="443.154" cy="113.54" fill="#172A3A" rx="36.154" ry="36.54"></ellipse>
            <text fill="#FFF" font-family="Novecentowide-Bold, Novecento wide" font-size="11" font-style="expanded" font-weight="bold" letter-spacing="2">
                <tspan x="69.177" y="117">72</tspan>
            </text>
            <text fill="#FFF" opacity=".918" font-family="Novecentowide-Bold, Novecento wide" font-size="11" font-style="expanded" font-weight="bold" letter-spacing="2">
                <tspan x="27.471" y="183">Investments</tspan>
            </text>
            <text fill="#FFF" font-family="Novecentowide-Bold, Novecento wide" font-size="11" font-style="expanded" font-weight="bold" letter-spacing="2">
                <tspan x="433.39" y="117">30</tspan>
            </text>
            <text fill="#FFF" opacity=".918" font-family="Novecentowide-Bold, Novecento wide" font-size="11" font-style="expanded" font-weight="bold" letter-spacing="2">
                <tspan x="350.356" y="183">Succesful Trade Sales</tspan>
            </text>
            <ellipse cx="807.001" cy="113.501" fill="#743B41" rx="47.001" ry="47.501"></ellipse>
            <ellipse cx="807.154" cy="113.54" fill="#172A3A" rx="36.154" ry="36.54"></ellipse>
            <text fill="#FFF" font-family="Novecentowide-Bold, Novecento wide" font-size="11" font-style="expanded" font-weight="bold">
                <tspan x="800.749" y="117">13</tspan>
            </text>
            <text fill="#FFF" opacity=".918" font-family="Novecentowide-Bold, Novecento wide" font-size="11" font-style="expanded" font-weight="bold">
                <tspan x="793.588" y="182.003">IPOs</tspan>
            </text>
        </g>
    </svg>


    <style>
     svg {
     display: block;
     margin: 0 auto;
     max-width: 1320px;
     }
    </style>