DEV Community

Orestis Pantazos
Orestis Pantazos

Posted on • Updated on

 

🏷️ Truncate String with Ellipsis in CSS

The front-end developers sometimes need to redesign the screen in order to truncate string with ellipsis in CSS technology. The best possible solution is the following:

.truncate-format {
  width: 100px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
Enter fullscreen mode Exit fullscreen mode

Latest comments (1)

Collapse
 
kvuluong profile image
kvu-luong

I think, it only the best possible solution in case single line, not for multiple lines :))
Something like this one:
"abc
xyz..."

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git