Home >Web Front-end >Front-end Q&A >How to remove attributes in css
How to remove attributes in css: first open the corresponding front-end code file; then find the attribute value that needs to be removed; finally, by setting the unset attribute for a certain keyword, the effect of removing the specified attribute can be achieved.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Reset or remove a certain css attribute value
There are the following scenarios:
You use someone else’s UI framework, and then you find that you The value dynamically assigned to the css is overwritten by the higher priority css of the UI framework. You can write js to change it, but if there are many layers of loop operations, you need to write a large section of js. At this time, js is not the best choice. What you really need is the 'unset' attribute
Unset priority
If unset is set for a certain keyword, such as color: unset; it will first choose to inherit the parent's attributes, and then choose to inherit its own attribute value, that is: inherit > initial
For example:
The attribute values p and span set the color value. If unset is set, the color value of h_bg will be selected to inherit.
HTML:
<header class="h_bg"> <p class="reset">title title title</p> <span class='reset'>text text text</span> </header>
CSS:
p{ color:red; } span{ color:blue; } .h_bg{ color:#FFF; background:#DEDEDE; padding:20px; text-align:center; width:200px; height:200px; } .reset{ color:unset; //去掉这个属性,文字会优先使用span和P的color值 }
[Recommended learning: css video tutorial]
The above is the detailed content of How to remove attributes in css. For more information, please follow other related articles on the PHP Chinese website!