I have been tackling the Order Summary Component challenge from FrontEnd Mentor and I am a bit perplexed about dynamically resizing <svg/>
elements. I want to ensure that I am on the right track as my CSS knowledge is limited.
My inquiries are as follows:
- Is setting the background pattern as a sibling to the card component, with the container styled as
position: relative
and the.background
div styled asposition: absolute; inset: 0;
, the correct technique for floating a background image behind a card? - For the svg element, should I aim to dynamically resize it so that the pattern scales not only with the height but also with the container width? Currently, I have set the svg
viewbox
to match the providedwidth
andheight
of the element and removed the specific width and height attributes. - Why do I see a 1px gap between the svg element and the card when zooming in? Should I adjust the viewbox attribute to make the svg slightly larger or is this not significant? This appears at certain zoom levels like 110%, 125%, 150%, and then disappears again at 200%.
Thank you in advance!