/ Published in: CSS

Add ... using css when string or title not fit on place
Add … if string is too long
Now, assuming the element has a fixed width, the browser will automatically break off and add the ... for you.
Add … if string is too long
Now, assuming the element has a fixed width, the browser will automatically break off and add the ... for you.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$out = strlen($in) > 50 ? substr($in,0,50)."..." : $in; or .ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
Comments
