HTML DOM Style listStyleImage property
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
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>
<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 Objects