<html>
<head>
<style>
#myDIV {
text-decoration: underline;
text-underline-offset: 0.5em;
}
</style>
</head>
<body>
<h1>Change text-underline-offset with JavaScript</h1>
<div id="myDIV">
Hello world!
</div>
<p>Click the "Try it" button to change the text-underline-offset of the div.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("myDIV").style.textUnderlineOffset = "1em";
}
</script>
</body>
</html>