Home > Web Front-end > HTML Tutorial > Don't let the text run around~_html/css_WEB-ITnose

Don't let the text run around~_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:54:27
Original
1287 people have browsed it

In order to make the web page layout regular, we often need to control the length and height of text paragraphs.

When we confidently drew a DIV frame for these words, we found that these words were far more naughty than we thought.

 

 <div style="width:800px;height:50px;border:1px solid red;">  调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的   文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。调皮的文字捣蛋的文字。 </div>
Copy after login

The running results are as follows:

At this time we add overflow:hidden to the div; let it run Hide the words that come out, as shown in the picture

Don’t pinch it even if you look at it, add a white-space:nowrap, as shown in the picture:

It’s still not pretty enough, here’s another text-overflow: ellipsis, as shown in the picture:

It feels much better....

Okay, let the big guys laugh, actually I’m here to ask: How can I make the text display three lines and replace the overflowing text with an ellipsis at the end of the last line???

Please enlighten me!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template