[Answered ]-Django Textfield maximum size to be displayed

2đź‘Ť

This is how you can do it in template with filter :
truncatechars

{{ value|truncatechars:9 }}

If value is “Joel is a slug”, the output will be “Joel i…”.

However this won’t expand when you hover or click. For that you need CSS text-overflow: ellipsis; (see this : https://jsfiddle.net/438sm8ed/)

.hide-partially {
  width:75px;
  text-overflow:ellipsis;
  overflow:hidden;
  white-space: nowrap;
}
.hide-partially:hover {
  overflow:visible;
}
👤Jaimes

Leave a comment