Currently experiencing an issue with a Bootstrap card. The transform: translateY(-50%);
property is being utilized to translate the element on the y-axis. Although the height of the parent div has been set to auto, the challenge arises in ensuring that the height adjusts automatically after the translation.
This is the HTML:
<div class="card layer-1-left-sub">
<img class="card-img-top profile-icon" src="images/profile-boy.jpg" alt="Card image cap">
<div class="card-body">
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
</div>
</div>
This is my CSS:
.layer-1-left-sub{
padding: 3px;
border: 2px solid #3f51b5;
border-radius: 5px;
margin: 0 auto;
float: none;
height: auto;
}
.profile-icon{
bottom: 0;
right: 0;
left: 0;
width: 150px;
height: 150px;
transform: translateY(-50%);
margin: 0 auto;
float: none;
display: block;
border-radius: 50%;
border: 2px solid #fff;
}
Encountering the following issue:
https://i.sstatic.net/ooLGh.png
An extra space exists between the image and paragraph that I aim to eliminate.