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

jQuery setting CSS property example introduction_jquery

WBOY
Release: 2016-05-16 17:03:20
Original
1240 people have browsed it
Set CSS properties

To set specific CSS properties, please use the following syntax:
Copy code The code is as follows:

css("propertyname","value");

The following example will set the background-color value for all matching elements:
Example
Copy code The code is as follows:

$("p").css ("background-color","yellow");

Set multiple CSS properties

To set multiple CSS properties, please use the following syntax :
Copy code The code is as follows:

css({"propertyname":"value", "propertyname":"value",...});

The following example will set the background-color and font-size for all matching elements:
Example
Copy code The code is as follows:

$("p").css({"background-color":"yellow ","font-size":"200%"});
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