A
A
Anton Schultz2020-05-14 12:40:04
css
Anton Schultz, 2020-05-14 12:40:04

How to limit the number of lines in the text so that after 2 the block of text ends with an ellipsis?

There is text where there are more than 2 lines per word or more, how to cut them with ellipsis and not let the block of text go beyond its height?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
drawnofmymind, 2020-05-14
@MrAnderson1999

<p class="clip">Магнитное поле ничтожно гасит большой круг небесной сферы, 
  в таком случае эксцентриситеты и наклоны орбит возрастают.</p>

p.clip {
    white-space: nowrap; /* Запрещаем перенос строк */
    overflow: hidden; /* Обрезаем все, что не помещается в область */
    text-overflow: ellipsis; /* Добавляем многоточие */
   }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question