HTML & CSS
<div id="hero">
<div id="social">
<img src="facebook.svg" alt="Facebook">
<img src="linkedin.svg" alt="LinkedIn">
<img src="instagram.svg" alt="Instagram">
</div>
</div>
CSS Styling with SASS
#hero {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 300px;
#social {
width: 50%;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
img {
width: 2em;
}
}
}
When attempting to resize SVGs using the CSS width
property, various outcomes are observed. Different attempts lead to icons collapsing towards the middle of the hero
div
:
img { width: 2em; }
https://i.sstatic.net/7fIsb.png
img { width: 3em; }
https://i.sstatic.net/7iw0h.png
img { width: 4em; }
https://i.sstatic.net/Pbceu.png
However, utilizing the CSS height
property provides the desired behavior:
img { height: 2em; }
https://i.sstatic.net/n10yp.png
img { height: 3em; }
https://i.sstatic.net/B25nT.png
img { height: 4em; }
https://i.sstatic.net/xcH8V.png
While this method achieves the desired result, it prompts questions about the correct approach and alternative ways to resize SVG images when using the Flexible Box Module. Any insights on better practices?