2024 answer here !
I tried all the options posted here, but I didn't succeed.
Here's my solution with javascript:
const myDiv = document.querySelector('.my-div');
const divHeight = myDiv.offsetHeight - 1;
myDiv.style.height = modalHeight + 'px';
I found that setting a height in CSS worked just fine but my case is to height always be set as "auto", so I use js to get the current height from my div and subtract by 1.
Worked like a charm!