I have a problem while using bootstrap card. I have used the transform: translateY(-50%); for translate the element to the y-axis , I have set the height of the parent div to auto, but the problem is that after translate the element, I want the height should be adjust automatically.
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;
}
this is the problem I am facing
I have a extra space between image and paragraph , I want to remove the extra space
