For example<p style="color:red">Set the attribute of p tag<p> Why use p.style.color? Why not style.color? style can be regarded as an object, and color is an attribute. Just use style.color directly.
Style itself is an attribute owned by the dom element p, which needs to be accessed through the current element. Access style.color directly. If the style of which element you want to access cannot be parsed, an error will be reported
style belongs to the inline style of p items and elements. It sets the attributes of p. The color and font-size in the attributes are equivalent to the attribute values.
Style is an attribute and must be behind the object. Just think about it, if you directly style.color, does that change the color of everything? Obviously this is not true.
No, Style is an attribute of the HTML element, and its value will be parsed by the browser into an inline style.
Style itself is an attribute owned by the dom element p, which needs to be accessed through the current element.
Access style.color directly. If the style of which element you want to access cannot be parsed, an error will be reported
style belongs to the inline style of p items and elements. It sets the attributes of p. The color and font-size in the attributes are equivalent to the attribute values.
Style is an attribute and must be behind the object. Just think about it, if you directly style.color, does that change the color of everything? Obviously this is not true.
If you want to set a color style, you should specify whose color to set, right?