In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces JavaScript how to obtain the relevant knowledge of CSS style, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value, I believe you will have something to gain after reading this JavaScript how to obtain CSS style article, let's take a look at it.
Syntax:
NodeObject.style.cssProperty
Where nodeObject is the node object and cssProperty is the CSS attribute.
For example:
?
one
two
Document.getElementById ("demo"). Style.height
Document.getElementById ("demo"). Style.border
Note: for CSS attributes separated by "-", remove "-" and capitalize the first letter after "-". For example:
Background-color is going to write backgroundColor
Line-height is going to write lineHeight
For example:
Document.getElementById ("demo") style. BackgroundColor
Document.getElementById ("demo"). Style.lineHeight
For example, get the style of the node of id= "demo":
Click here to get the CSS style
How to set and modify CSS style by JavaScript
Syntax:
NodeObject.style.cssProperty=newStyle
Where nodeObject is the node object, cssProperty is the CSS attribute, and newStyle is the value of the CSS attribute.
Note: for CSS attributes separated by "-", remove "-" and capitalize the first letter after "-".
For example:
Document.getElementById ("demo") .style.height = "50px"
Document.getElementById ("demo") .style.border = "1px solid # ddd"
Document.getElementById ("demo") .style.backgroundColor = "# ccc"
Document.getElementById ("demo") .style.textAlign = "center"
For example, style the node of id= "demo":
This is the end of the article on "how JavaScript gets the CSS style". Thank you for reading! I believe you all have a certain understanding of "how JavaScript obtains CSS style" knowledge. If you want to learn more, you are welcome to follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.