Home >Web Front-end >JS Tutorial >How to make text automatically hide and display ellipses after it exceeds the div

How to make text automatically hide and display ellipses after it exceeds the div

php中世界最好的语言
php中世界最好的语言Original
2018-03-14 10:44:183138browse

This time I will show you how to make the text automatically hide and display the ellipsis after it exceeds the div, and how to automatically hide and display the ellipsis after the text exceeds the div. one time. After the text exceeds the div, it will be automatically added...

Just set the following style in css:

label{
     width: 25px;   //必须设定宽度
    overflow: hidden;
    text-overflow: ellipsis; //设置文字溢出时
    white-space: nowrap;
    word-break: keep-all;
}

I believe you have mastered the method after reading the case in this article, more Please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of css3 shadow


JavaScript array usage collection


How to use canvas to draw the starry sky, moon, earth, and add text


##How to use canvas to draw arcs and circles

The above is the detailed content of How to make text automatically hide and display ellipses after it exceeds the div. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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