Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide last character in string with pure css [closed]

Tags:

css

Is it possible to remove or simply hide the very last character in a string in pure css?

When I search for this all I find is javascript / jQuery solutions.

Thank you in advance.

like image 278
Steeven Avatar asked Dec 26 '22 08:12

Steeven


1 Answers

Use CSS3 text-overflow.

(More information about text-overflow)

Live demo on jsfiddle


CSS:

#txt{
    position:relative;
    padding:7px;
    text-align:justify;
    background:#e7e7e7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

Working in: (latest versions)

  • firefox
  • chrome
  • opera
  • ie ( does not matter :D )
like image 118
mostafaznv Avatar answered Feb 23 '23 18:02

mostafaznv