Tampilkan Dot Dot Setelah beberapa kata PHP
The PHP way of doing this is simple:
$out = strlen($in) > 50 ? substr($in,0,50)."..." : $in;
But you can achieve a much nicer effect with this CSS:
.ellipsis {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
Now, assuming the element has a fixed width, the browser will automatically break off and add the ... for you.
Disgusted Dragonfly