Answers for "show dot dot after some words php"

PHP
0

show dot dot after some words 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.
Posted by: Guest on March-13-2021

Browse Popular Code Answers by Language