I've looked through several discussions here, but none of the suggested solutions seem to work for my specific situation.
My issue involves an SVG that was created on a different website. It contains three elements, and I'd like to embed it while centering it within a div and ensuring it occupies around 80% of the div's width while preserving its aspect ratio.
I attempted to use a logo
class by applying it to both the SVG and the div, but unfortunately, the SVG does not resize as expected. Being new to embedding SVGs, I suspect I may have overlooked something straightforward. Any guidance or suggestions would be greatly appreciated.
HTML:
<div class="logo">
<svg viewBox="0 0 100 100" height="125.10821574604812" width="386" style="width: 386px; height: 125.108px; display: inline-block;">
<g id="SvgjsG1007" featurekey="symbolFeature-0" transform="matrix(0.24606297734400367,0,0,0.24606297734400367,-0.99212501603224,-0.46136984249956975)" fill="black">
<path xmlns="http://www.w3.org/2000/svg" d="M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0"></path></g>
<g id="SvgjsG1008" featurekey="textGroupContainer" transform="matrix(1,0,0,1,385,15)" fill="black">
<rect xmlns="http://www.w3.org/2000/svg" y="0" height="1" width="1" opacity="0"></rect><rect xmlns="http://www.w3.org/2000/svg" y="0" x="-265" width="3" height="96"></rect></g>
<g id="SvgjsG1009" featurekey="vMvB0T-0" transform="matrix(2.9018419606484582,0,0,2.9018419606484582,135.09815803935155,27.97299999605343)" fill="black">
<path d="M1 20 l0 -8.4 c0 -5.58 0 -7.78 3 -7.78 s3 2.2 3 7.78 l0 8.4 l-2 0 l0 -4.6 l-2 0 l0 4.6 l-2 0 z"></path></g>
</svg>
</div>
CSS:
.logo {
width: 80% !important;
align-content: center;
}
Snippet - the SVG doesn't resize no matter the size set inside the div:
.logo {
width: 80% !important;
align-content: center;
}
<div class="logo">
<svg viewBox="0 0 100 100" height="125.10821574604812" width="386" style="width: 386px; height: 125.108px; display: inline-block;">
<g id="SvgjsG1007" featurekey="symbolFeature-0" transform="matrix(0.24606297734400367,0,0,0.24606297734400367,-0.99212501603224,-0.46136984249956975)" fill="black">
<path xmlns="http://www.w3.org/2000/svg" d="M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0"></path></g>
<g id="SvgjsG1008" featurekey="textGroupContainer" transform="matrix(1,0,0,1,385,15)" fill="black">
<rect xmlns="http://www.w3.org/2000/svg" y="0" height="1" width="1" opacity="0"></rect><rect xmlns="http://www.w3.org/2000/svg" y="0" x="-265" width="3" height="96"></rect></g>
<g id="SvgjsG1009" featurekey="vMvB0T-0" transform="matrix(2.9018419606484582,0,0,2.9018419606484582,135.09815803935155,27.97299999605343)" fill="black">
<path d="M1 20 l0 -8.4 c0 -5.58 0 -7.78 3 -7.78 s3 2.2 3 7.78 l0 8.4 l-2 0 l0 -4.6 l-2 0 l0 4.6 l-2 0 z"></path></g>
</svg>
</div>