Home  >  Article  >  Web Front-end  >  How to set the beyond part to be hidden in css

How to set the beyond part to be hidden in css

coldplay.xixi
coldplay.xixiOriginal
2021-04-16 14:14:4023634browse

How to set the overflow hidden part in css: first create a new file and use the div tag to create text; then set the class attribute of the div tag to txtdiv; then set the style of the div through class; and finally use "overflow:hidden ” to set not to display when the text in the div exceeds the width.

How to set the beyond part to be hidden in css

The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.

How to set the excess part to be hidden in css:

1. Create a new html file, named test.html, to explain how to set the excess part to be hidden in css.

How to set the beyond part to be hidden in css

2. In the test.html file, use the div tag to create a line of text for testing.

How to set the beyond part to be hidden in css

3. In the test.html file, set the class attribute of the div tag to txtdiv, which will be used to define its style through this class below.

How to set the beyond part to be hidden in css

4. In the css tag, set the style of the div through class, define its width as 100px, height as 25px, and background color as gray.

How to set the beyond part to be hidden in css

5. In the css tag, use "overflow:hidden" to set it to hide and not display when the text in the div exceeds the width.

How to set the beyond part to be hidden in css

6. Open the test.html file in the browser and view the results.

How to set the beyond part to be hidden in css

Related tutorial recommendations: CSS video tutorial

The above is the detailed content of How to set the beyond part to be hidden in css. 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