Home > Article > Web Front-end > How to cancel style in css
How to cancel styles in css: 1. To remove all styles, use [removeattr ("style")]; 2. To remove a single style, use [css ("attribute", "")].
The operating environment of this tutorial: windows7 system, css3 version, DELL G3 computer.
How to cancel styles in css:
1. To remove all styles, use removeattr("style");
The removeAttr() method removes attributes from selected elements.
Syntax:
$(selector).removeAttr(attribute)
2. To remove a single style, use css ("property", "");
css() method setting or Returns one or more style properties of the selected element.
To set specific CSS properties, please use the following syntax:
css("propertyname","value");
Example:
<script type="text/javascript"> $(function(){ $("li").mouseover(function(){ //添加css样式 $(this).css("background","#ffdd00"); }); $("li").mouseout(function(){ //移出css样式 $(this).css("background",""); }); }); </script>
Recommended related tutorials: CSS video tutorial
The above is the detailed content of How to cancel style in css. For more information, please follow other related articles on the PHP Chinese website!