Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <h1 style="color: red; font-size:50px;">The cssText Property</h1> <p>Click the button to return the value of the element's inline style declaration.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var elmnt = document.getElementsByTagName("h1")[0]; var x = elmnt.style.cssText; document.getElementById("demo").innerHTML = x; } </script> </body> </html>