How to summarize a text within span? [duplicate]

6

Well I have the following code:

<span>TÍTULO CONTAINER TEXO TEXTO TEXO TEXTO</span>

I need this span to have width: 100% and that it has no line break, if the text is too large it has to summarize and put ( ... ).

Can you do this with css?

    
asked by anonymous 30.12.2016 / 12:47

1 answer

6

You can set text-overflow as ellipsis in your style:

span {
     text-overflow: ellipsis;
 }

Example:

span {
  display: inline-block;
  width: 100%;
  white-space: nowrap;
  overflow: hidden !important;
  text-overflow: ellipsis;
}
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce maximus dui eu libero facilisis venenatis. Pellentesque placerat vulputate semper. </span>
    
30.12.2016 / 12:50