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>The item() Method</h1> <p>Click the button to return the first CSS property name from the style declaration of the "ex1" element:</p> <div id="ex1" style="color:blue; font-family:monospace;">Some text</div> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var style = document.getElementById('ex1').style; var propname = style.item(0); alert(propname); } </script> </body> </html>