Home > Web Front-end > CSS Tutorial > How to set css in jq

How to set css in jq

coldplay.xixi
Release: 2023-01-05 16:12:48
Original
6428 people have browsed it

jq How to set css: 1. Set a single style attribute, the code is [$('#test').css('background-color','red')]; 2. Set multiple attributes You can pass in an object, the code is [$('#test').css({'background].

How to set css in jq

The operating environment of this tutorial: windows7 System, css3 version, DELL G3 computer.

How to set css with jq:

If you want to set a single style attribute, you can do this

$('#test').css('background-color','red');
Copy after login

If you To set multiple attributes at the same time, you can pass in an object

$('#test').css({'background-color':'red','font-size':'20px'});
Copy after login

, which is the attribute value such as background-color. You can also use camel case backgroundColor. In this case, you do not need single quotes

You can try it yourself







jquery 设置css

Copy after login

Recommended related tutorials: CSS video tutorial

The above is the detailed content of How to set css in jq. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
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