I'm currently working on implementing an expand/collapse feature with a red close 'X' button in a Bootstrap 4 card. I've almost got it working, but when I try to place the red close icon outside the element that controls the expand/collapse functionality, it ends up moving the button to a different row. Any suggestions on how to fix this issue?
I've already experimented with adjusting margin-right and padding-right properties, but haven't been successful. Can anyone provide assistance?
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<div class="card ml-5 mr-5 mt-5">
<h5 class="card-header expandable">
<a style='padding-right:-10px' data-toggle="collapse" href="#collapse-example1" aria-expanded="true" aria-controls="collapse-example1" id="heading-example" class="d-block">
<i class="rotate fa fa-chevron-down "></i>
good style
<i style='color:red' class="fa fa-close pull-right"></i>
</a>
</h5>
<div id="collapse-example1" class="collapse show" aria-labelledby="heading-example">
<div class="card-body">
card body
</div>
</div>
</div>
<div class="card ml-5 mr-5 mt-5">
<h5 class="card-header expandable">
<a style='padding-right:-10px' data-toggle="collapse" href="#collapse-example" aria-expanded="true" aria-controls="collapse-example" id="heading-example" class="d-block">
<i class="rotate fa fa-chevron-down "></i>
uh oh card-title margin looks weird?
</a>
<i style='color:red' class="fa fa-close pull-right"></i>
</h5>
<div id="collapse-example" class="collapse show" aria-labelledby="heading-example">
<div class="card-body">
card body
</div>
</div>
</div>