<div class="text">font-size: </div>
.text {
  font-size: clamp(20px, 5vw, 40px);
}

/* Helpers*/
BODY {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font: 22px/1 Trebouchet MS, Arial, sans-serif;
}

DIV {
  padding: 1em;
  border: .5em solid yellowgreen;
}

DIV::after {
  content: attr(data-size)
}
const elements = document.querySelectorAll('DIV');

const showWidth = () => {
  elements.forEach(element => {
    const style = window.getComputedStyle(element, null);
    element.dataset.size = style.fontSize;
  })
}

showWidth();

window.addEventListener('resize', showWidth);
View Compiled

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.