I have such a bootstrap card:
.task__content {
transition: transform 0.2s linear 0s;
transform: scaleY(0);
transform-origin: top center;
}
.task:hover .task__content {
transform: scaleY(1);
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="task card" data-is-complete="incomplete">
<div class="task__toolbar card-header d-flex align-items-center py-2">
<!--task checklist-->
<form class="task__form mr-3">
<div class="task__form-block form-check"><input class="task__checkbox" type="checkbox" /></div>
</form>
<!--task title-->
<div class="task__title">
<p>Test Title</p>
</div>
<!--task btn bar-->
<div class="task__btn-bar d-flex ml-auto">
<!--expand button (optional - appears only if there is a task description)--><button class="task__descr-expand btn btn--iconed btn-sm" type="button"><span class="btn__icon--lg material-icons">expand</span></button>
<!--edit task btn--><button class="task__edit btn btn--iconed btn-sm" type="button"><span class="btn__icon material-icons">edit</span></button>
<!--delete task btn--><button class="task__del btn btn--iconed btn-sm" type="button"><span class="btn__icon material-icons">close</span></button></div>
</div>
<div class="task__content card-body d-flex align-items-center">
<!--task description-->
<div class="task__descr">
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et</p>
</div>
</div>
</div>
I want to hide a .task__content
part via transform: scaleY(0)
and to reveal it on .task
hover, but for some reasons there remains a strange vertical empty space between borders. What am I doing wrong here? Why the empty space remains if .task__content
is hidden via transform scale?
3
Answers
Ok, the issue is that
transform: scaleY(0)
is not affecting (like any other transform scales) the element's parent size and it's not affect an html elements flow on the page. That's why even if I hide an element via scaling, there is an extra empty space.So to achieve the effect I want to create, I need to apply such a code:
With
display
changing I can reduce the blank space when.task__content
is hidden, withtransform
,keyframes
andanimation
I still can apply a smooth revealing effect on hover.as per your explanation for the border part it’s from class
.card{ border: 1px solid rgba(0,0,0,.125);}
you can over ride it.card{ border: none !important}
… and for the height it’s because the inline styled-flex
remove it and you can manipulate it withheight:0%
and when hoverheight:100%
There is bootstrap card make
card-body
padding all sideChanges to both right and left only