1

I have a block with fixed height:

div {
  font-size: 16px;
}
<div class="card" height="200px">
  text...
</div>

How to resize text if it does not fit in div by height?

deekeh
  • 675
  • 1
  • 6
  • 21
  • 2
    I think this [SO post](https://stackoverflow.com/questions/10718840/make-text-height-100-of-div) might help you. Just a heads up, it makes use of scripts to attain the desired result though. – deekeh Dec 31 '21 at 16:46

1 Answers1

0

using the javaScript

<div id = "theId" class="card" height="200px">
    text...
</div>
<script>
    let theNewHeight = "16px"
    document.getElementById("theId").style.height = theNewHeight;
</script>

or set the value in css to % instead of px

div {
   font-size: 16%;
}

that 'll change it depending on the size of document, witch means 16% of the document.