This style works for e.g. chrome.
p.ex1 {
max-height: fit-content;
height: 250px;
border:solid 1px black;
overflow: auto;
}
The intention is to use the whole height, with scrolling, if necessary, but shrink height to fit content if the content is small. However, how is this accomplished in Firefox?
https://www.w3schools.com/cssref/tryit.asp?filename=trycss_dim_max-height
fit-content
is experimental and not supported in many browsers. I would use flex insteadmax-height: 250px
and defaultauto
height (which is exactly the content height) instead?