I am working with a Bootstrap 5 List Group element on my webpage. To enhance its visual appeal, I want to include oversized Font Awesome icons.
After some styling and using a span tag, I managed to add the icon successfully. However, the issue I am facing is that the icon is overflowing from the list-group-item boundaries. You can see the problem in the images below:
https://i.sstatic.net/FPEQd.png
https://i.sstatic.net/2tCVa.png
I have attempted to keep the icon within the list-group-item by manipulating the z-index, but it has not proven effective.
I suspect the positioning of the span element might be causing this issue?
.pages-icon {
font-size: 90px;
position: absolute;
right: 0;
top: -20px;
transform: rotate(11.81deg);
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a7875756e696e687b6a5a2f34283429">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<div class="list-group rounded-10">
<a href="#" class="list-group-item list-group-item-action w-100">
<span class="pages-icon"><i class="fa-thin fa-people-group text-cpPink"></i></span> Our People
</a>
<a href="#" class="list-group-item list-group-item-action">
<span class="pages-icon"><i class="fa-thin fa-building text-cpBlue"></i></span> Offices
</a>
<a href="#" class="list-group-item list-group-item-action">Departments</a>
<a href="#" class="list-group-item list-group-item-action">Business Information</a>
<a href="#" class="list-group-item list-group-item-action">Events & What's On</a>
<a href="#" class="list-group-item list-group-item-action">Events & What's On</a>
</div>