html tutorial - How to truncate long string with ellipsis using CSS - html5 - html code - html form
Answer: Use the CSS text-overflow property
CSS text-overflow property can be used together with the white-space and overflow properties to truncate or clip long text and place the dot-dot or ellipsis (...) at the end to determine the clipped text or indicate the user.
Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Truncating Long Text with CSS</title>
<style type="text/css">
p {
width: 400px;
padding: 10px;
background: #E6E6FA;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit ame sem tempor, varius quam at, luctus dui. Mauris magna metus, dapibus nec turpis vel, semper malesuada ante.</p>
</body>
</html>