Return the value of the inline style of a H1 element:
var elmnt = document.getElementsByTagName("h1")[0];
var x = elmnt.style.cssText;
Try it Yourself »
The cssText property sets or returns the value of an element's inline style declaration.
Property | |||||
---|---|---|---|---|---|
cssText | Yes | Yes | Yes | Yes | Yes |
Return the cssText property:
element.style.cssText
Set the cssText property:
element.style.cssText =
style
DOM Version: | Level 2 Style CSS |
---|---|
Return Value: | A String, representing the inline style of the specified element |
Set the text of the element's inline style declaration:
document.getElementById("ex1").style.cssText = "color: blue;";
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!