My SVG component is currently responsive. However, I am looking to maintain a fixed height of 352px for the SVG while allowing the width to decrease when resizing the window. This way, users can still view my SVG images even as they resize the window.
Does anyone know how to achieve this? Any advice on setting the height while reducing the width for an SVG component?
Here is the code snippet:
/* Carousel CSS */
.svg-container {
width:100vw;
}
<div class="carousel-item active svg-container">
<svg id="svg1" version="1.1" viewBox = "0 1 1365 352" preserveAspectRatio="xMidYMid meet">
<line x1="0" y1="352px" x2="100%" y2="352px" stroke="rgba(76, 61, 104, 0.4)" stroke-width="1"/>
<g class="kitchen" transform="translate(400,0)">
<!-- Kitchen elements -->
</g>
<g class="flowerpot" stroke="rgba(76, 61, 104, 0.4)" stroke-width="1" >
<!-- Flowerpot SVG path -->
<path fill="none" opacity="1"
d="M103,171 C 102,207 105,226 118,238 L183,238 C 195,228 200,205 198,170.5" transform="translate(750,113)"/>
<line x1="852.5" y1="283.5" x2="948.3" y2="283.5" />
</g>
<g class="plant" stroke="rgba(76, 61, 104, 0.4)" stroke-width="1" >
<!-- Plant SVG elements -->
</g>
</svg>
</div>