Skip to content

text overflow

garevna edited this page Jul 6, 2019 · 4 revisions

ico25 Текст

ico20 text-overflow

Теперь рассмотрим ситуацию, когда отображается только часть текста, а то, что выходит за пределы контейнера, обрезается

Для того, чтобы текст, выходящий за границу контенера, не отображался, устанавливаем значения свойств:

  • white-space: nowrap
  • overflow: hidden

Теперь используем свойство text-overflow:

CSS
p {
    max-width: 50%;
    white-space: nowrap;
    overflow: hidden;
}
p:hover {
    white-space: pre-wrap;
}
.dots {
    text-overflow: ellipsis;
}
.clip {
    text-overflow: clip;
}
html
<body>
<h4>text-overflow: ellipsis</h4>
<p class="ellipsis">
    The word-break property in CSS can be used to change when line breaks ought to occur.
    Normally, line breaks in text can only occur in certain spaces,
    like when there is a space or a hyphen
</p>

<h4>text-overflow: clip</h4>
<p class="clip">
    The word-break property in CSS can be used to change when line breaks ought to occur. 
    Normally, line breaks in text can only occur in certain spaces, 
    like when there is a space or a hyphen
</p>
</body>

© Irina H.Fylyppova 2019



Занятие 1


Занятие 2


Занятие 3


Занятие 4


Занятие 5


Занятие 6


Занятие 7


Занятие 8


Дополнительно

Clone this wiki locally