Свойства CSS: Как использовать свойство переполнения текста
Перейти на страницу упражнений
Решение:
HTML-код:
<!DOCTYPE html>
<html>
<head>
<title>How to use text-overflow property</title>
<style type="text/css">
#div1 {
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
border: 1px solid #FF0000;
}
#div2 {
white-space: nowrap;
width: 100%;
overflow: hidden;
text-overflow: clip;
border: 1px solid #FF0000;
}
</style>
</head>
<body>
<h2><strong>w3resource Tutorial</strong></h2>
<p>Text overflow: ellipsis</>
<div id ="div1">CSS, stands for Cascading Style Sheet is a computer language to describe presentation (for example width, height, color, background color, alignment etc.) of HTML and XML (and XML based languages like XHTML, SVG) web documents. In all the examples of our tutorials, we have used HTML for implementing CSS.CSS, stands for Cascading Style Sheet is a computer language to describe presentation (for example width, height, color, background color, alignment etc.) of HTML and XML (and XML based languages like XHTML, SVG) web documents.</div>
<p>Text overflow: clip</>
<div id ="div2">CSS, stands for Cascading Style Sheet is a computer language to describe presentation (for example width, height, color, background color, alignment etc.) of HTML and XML (and XML based languages like XHTML, SVG) web documents. In all the examples of our tutorials, we have used HTML for implementing CSS.CSS, stands for Cascading Style Sheet is a computer language to describe presentation (for example width, height, color, background color, alignment etc.) of HTML and XML (and XML based languages like XHTML, SVG) web documents.</div>
</body>
</html>
Демонстрация в реальном времени:
Посмотрите текст-переполнение-ответ Pen по w3resource ( @ w3resource ) на CodePen .
Поддерживаемый браузер
да | да | да | да | да |
Каков уровень сложности этого упражнения?
Новый контент: Composer: менеджер зависимостей для PHP , R программирования
disqus2code