How to invalidate css styles: First create an HTML sample file; then use the div tag to create a line of text and add css styles to the text; finally use the css comment "/* */" to invalidate the required Just comment the css code.
![How to invalidate styles in css](https://img.php.cn/upload/article/202104/08/2021040809115182099.jpg)
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Create a new html file, named test.html, to explain how to invalidate css in a certain area.
![1617844381696993.png How to invalidate styles in css](https://img.php.cn/upload/image/974/612/463/1617844381696993.png)
In the test.html file, use the div tag to create a line of text and set its class to dcss. It is mainly used to set the css style through this class below.
![1617844385683277.png How to invalidate styles in css](https://img.php.cn/upload/image/725/581/789/1617844385683277.png)
##In the test.html file, write the tag. The css style of the page will be written in this within the label.
![1617844391967226.png How to invalidate styles in css](https://img.php.cn/upload/image/138/552/201/1617844391967226.png)
In the css tag, set the style of the div element. Use font-size to set the text size to 30px, use color to set the text color to red, and use font-weight to set it. The font is bold, and background color is set to gray using background.
![1617844396210512.png How to invalidate styles in css](https://img.php.cn/upload/image/320/821/731/1617844396210512.png)
Open the test.html file in the browser to check the effect.
![1617844401691360.png How to invalidate styles in css](https://img.php.cn/upload/image/816/141/598/1617844401691360.png)
In the test.html file, use the css comment characters "/* */" to comment the css code that needs to be invalidated. For example, only keep the text size and text color. The css style invalidates the bold attribute and background color of the div element.
![1617844405200046.png How to invalidate styles in css](https://img.php.cn/upload/image/283/774/827/1617844405200046.png)
Open the test.html page in the browser again. It can be seen that the commented out css code has been successfully invalidated.
![1617844410843292.png How to invalidate styles in css](https://img.php.cn/upload/image/418/729/387/1617844410843292.png)
[Recommended learning:
css video tutorial]
The above is the detailed content of How to invalidate styles 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