<!DOCTYPE html>
<html lang="en-US">
<head>
<style>
div{
border: 2px solid black;
white-space: nowrap;
overflow: hidden;
padding: 2px;
margin-bottom: 10px;
width: 50px;
}
</style>
</head>
<body>
<h1>CSS text-overflow Property</h1>
<div>This is a sentence.</div>
<button onclick="myFunction()">Click Me</button>
<script>
var x = document.getElementsByTagName("div")[0];
function myFunction(){
x.style.textOverflow = "ellipsis";
}
</script>
<p><strong>Note</strong>: click on the button to change the 'text-overflow' from clip to ellipsis.</p> </body>
</html>