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.
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.
2. In the test.html file, use the div tag to create a line of text for testing.
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.
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.
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.
6. Open the test.html file in the browser and view the results.
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!