How to display ellipsis when css exceeds width

藏色散人
Release: 2021-05-17 14:18:54
Original
5004 people have browsed it

How to display ellipsis in css beyond the width: first create a new HTML document; then define the

How to display ellipsis when css exceeds width

The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.

First, create a new HTML document to host CSS

How to display ellipsis when css exceeds width

Save the above part and preview the effect in the browser. At this moment, CSS is not introduced. The effect of setting

How to display ellipsis when css exceeds width

Define the

How to display ellipsis when css exceeds width

Define a piece of CSS for the h1 tag to set the display of the ellipsis beyond the part. Example:

h1{
            width: 300px;/*定义块元素的宽度*/
            white-space: nowrap;/*内容超宽后禁止换行显示*/
            overflow: hidden;/*超出部分隐藏*/
            text-overflow:ellipsis;/*文字超出部分以省略号显示*/
}
Copy after login

How to display ellipsis when css exceeds width

Save the above file and preview the effect in the browser

How to display ellipsis when css exceeds width

Recommended: "css video tutorial"

The above is the detailed content of How to display ellipsis when css exceeds width. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!