I have been trying to use the css function clamp()
to control the height of my div, but for some reason it is not behaving as I expected.
.container{
height: clamp(200px, auto, 400px);
}
Interestingly, it works perfectly fine when I define the heights individually like this:
.container{
min-height: 200px;
height: auto;
max-height: 400px;
}
According to the documentation on css clamp(): MDN Web Docs, it should essentially combine the functionalities of min
, max
and value
. So why is it not working in my case?