I have a div
element which should be exactly the same shape and size of its icon
content.
I'm designing a component in Angular 9 which is a button that navigates you to the previous page. I want this component to be reusable, so the icon element inside it must be changeable. I easily achieve this through Angular's content projection, but the problem is that the div outer container is actually bigger than its content, resulting in the icon area being overflown by the real "clickable" area.
This is the html page
<div class="back-button-container clickable" (click)="navigateBack()">
<ng-content select="[icon]"></ng-content>
</div>
Without content-projection, the html page would look like this (I think my problem is beyond Angular content projection)
<div class="back-button-container clickable" (click)="navigateBack()">
<i icon class="far fa-2x fa-arrow-alt-circle-left" ></i>
</div>
display: inline-block
, as suggested here, doesn't work.