Latest web development tutorials

HTML DOM Style listStyleImage property

Style Object Reference Style Objects

Definition and Usage

cssText property sets or returns the string as a style statement content.

grammar

Setting cssText properties:

Object.style.cssText="string"

Back cssText properties:

Object.style.cssText

描述
string 规定样式声明的内容。


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support cssText property.


Examples

Examples

Get style statement as a string:

<html>
<head>
<script>
function displayResult()
{
alert(document.getElementById("p1").style.cssText);
}
</script>
</head>
<body>

<p id="p1" style="border:2px dashed green;color:red;">This is a paragraph.</p>
<br>
<button type="button" onclick="displayResult()">Get style declaration</button>

</body>
</html>

try it"


Style Object Reference Style Objects