Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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.
 
PREVIOUS NEXT
Tagged: #show #dot #dot #words #php
ADD COMMENT
Topic
Name
7+5 =