In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use jQuery style to operate css, I hope you will learn something after reading this article, let's discuss it together!
JQuery style operation
Manipulate the css method:
JQuery can use the css method to manipulate and modify simple element styles, and some can manipulate classes to modify multiple styles.
1. Parameter only writes the property name, the property value is returned.
$(this) .css ("color")
two。 Parameters are property names, attribute values, comma-separated, set a set of styles, attributes must be in quotation marks, and values can be followed by units and quotation marks if they are numbers.
(this) .css ("color", "red")
(this) .css ("width", "220px")
3. Parameters can be in the form of objects, it is convenient to set multiple groups of styles, attribute names and attribute values are separated by colons, and attributes can be unquoted.
(this) .css ({"color": "blue", "font-size": "20px"})
Div {width:200px; height: 300px; background-color: pink } laugh and forget console.log ($("div"). Css ("width")); / / 200px $("div"). Css ("width", "350px"); $("div"). Css ("width", 300) ("div") .css ({"color": "blue", "font-size": 20, backgroundColor: "red"}) / / if it is a compound attribute, use the hump naming method, if the value is not a number, then add quotation marks to finish reading this article, I believe you have a certain understanding of "how to use jQuery style to operate css". If you want to know more about it, welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.