Handling Text Overflow in CSS3


The text-overflow property is used in CSS3 to determine how overflowed content that is not displayed is signaled to users

Following is the code for handling text overflow in CSS3 −

Example

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
body {
   font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}
div {
   white-space: nowrap;
   width: 100px;
   overflow: hidden;
   border: 1px solid #3008c0;
   margin: 10px;
   padding: 10px;
}
.clip {
   text-overflow: clip;
}
.ellipsis {
   text-overflow: ellipsis;
}
</style>
</head>
<body>
<h1>Handling text overflow example</h1>
CLIP:
<div class="clip">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum, beatae.
</div>
ELLIPSES:
<div class="ellipsis">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Rerum, beatae.
</div>
</body>
</html>

Output

The above code will produce the following output −


Advertisements