Home > Web Front-end > JS Tutorial > body text

jQuery adds priority level of style attributes

巴扎黑
Release: 2017-06-26 14:34:14
Original
1874 people have browsed it

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

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

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!