HTML
<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 using 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;
}
}
}
I’m not able to resize SVGs using the CSS width
property. Here is what I obtain with different approaches (note how icons collapse toward the middle of the hero
div
):
img { width: 2em; }
img { width: 3em; }
img { width: 4em; }
However, if I use the CSS height
property:
img { height: 2em; }
img { height: 3em; }
img { height: 4em; }
I get the behaviour I need, but I’m not sure this is the right way. Why does this happen? Do you know better ways of resizeing SVG images (especially using the Flexible Box Module)?
width
and theheight
of the SVG I think I can scale it without problems. – Diactinic