Home >Web Front-end >JS Tutorial >jQuery setting CSS property example introduction_jquery

jQuery setting CSS property example introduction_jquery

WBOY
WBOYOriginal
2016-05-16 17:03:201310browse
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%"});
Statement:
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