Add multiple attributes to the jQuery class
$('#five .a')
.css({
color:'blue',
border:'2px solid green',
background:'blue'
});
Copy after login
jQuer adds a class to the element
$('#five .a')
.addClass('funny');
Copy after login
HTML code
<style>
.funny{
font-size: 21px;
background-color: gray ;
padding: 10px;
color: yellow ;
}
</style>
<div id="five">
<div class="a">A</div>
</div>
Copy after login
![jQuery adds priority level of style attributes](https://img.php.cn/upload/article/000/000/001/c2561ccbe5f15d744dd7dd3cff87c524-0.png)
You can see The rendering effect of adding multiple attributes to the jQuery class appears as an inline style.
The class added by jQuer to the element does not have a high priority as the inline style
You can see that there is no funny one in the rendering effectbackground-color: gray ;andcolor: yellow ;Attribute.
![jQuery adds priority level of style attributes](https://img.php.cn/upload/article/000/000/001/c2561ccbe5f15d744dd7dd3cff87c524-1.png)
The above is the detailed content of jQuery adds priority level of style attributes. For more information, please follow other related articles on the PHP Chinese website!