I want to replace the Fontawesome icons from this template. Full HTML is here but I just want to replace this icon with an SVG.
<div class="col-md-4">
<span class="fa-stack fa-4x">
<i class="fas fa-circle fa-stack-2x text-primary"></i>
<i class="fas fa-shopping-cart fa-stack-1x fa-inverse"></i>
</span>
<h4 class="my-3">E-Commerce</h4>
<p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p>
</div>
I tried to replace it with the simple SVG representing number 5 sourced here. I don't understand what fa-stack and other Fontawesome code does, so I am struggling to replace it.
Any idea on how to replace the Fontawesome logo for a SVG?
<div class="col-md-4">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="96" height="96" class="text-primary">
<g clip-path="url(#clip0_429_10989)">
<circle cx="12" cy="12" r="9" stroke="#292929" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M9.5 16.2361C10.0308 16.7111 10.7316 17 11.5 17C13.1569 17 14.5 15.6569 14.5 14C14.5 12.3431 13.1569 11 11.5 11C10.7316 11 10.0308 11.2889 9.5 11.7639L10.5 7H14.5" stroke="#292929" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_429_10989">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>
</svg>

FontAwesome "fa-classes"
Most
fa-prefixed classes are used for selecting different icons e.gfa-shopping-cartadd shopping-cart icon.Some of them are used for resizing/scaling the icon e.g
fa-stack-2xIcon's
viewBoxmust match the icon's bounding boxIn your example you've copied the fontAwesome viewBox 512x512.
But your new icon has an intrinsic size of ~ 21x21 SVG user units.
So by increasing the viewBox you add additional whitespace around your icon.
See also Css-tricks: "6 Common SVG Fails (and How to Fix Them)"
You can get a tight/minimum viewBox via
getBBox()Besides, you need to replace replace specific stroke colors with
currentColorvalue – this way the icon can inherit the parent's text color for strokes and fills.