How can I prevent the text on a Bootstrap 5 button with horizontally and vertically centered text, along with a right aligned icon, from overlapping when it wraps? Additionally, how do I ensure that the icon stays vertically centered when the button text wraps, and maintain vertical center alignment for the button text upon wrapping?
To see the code example with wrapping and overlapping issues, please visit this fiddle and adjust the display area size.
.custom-btn,
.custom-btn:visited {
position: relative;
padding: 1.5rem 0.5rem;
margin: 0.5rem 0.5rem;
font-size: 0.95rem;
border-radius: 0;
line-height: 1.2rem;
background-color: #c1c1c1;
border-color: #c1c1c1;
flex: 33%;
text-transform: uppercase;
color: #fff;
box-sizing: border-box;
letter-spacing: 0.8px;
height: 70px;
}
.custom-btn:active,
.custom-btn:hover {
background-color: #7d7c7c;
border-color: #787878;
text-transform: uppercase;
color: #fff;
}
.icon-arrow-new {
position: absolute;
right: 10px;
width: 22px;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62000d0d16111610031222574c534c51">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<a href="#" target="_blank" class="btn custom-btn">This Section<img src="https://svgshare.com/i/fPK.svg" class="icon-arrow-new" /></a>