Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the Document</title> </head> <body> <div id="div" style="color:green; font-size:150%">Welcome</div> <script> // string alert(div.getAttribute('style')); // color:green; font-size:80% // object alert(div.style); // [object CSSStyleDeclaration] alert(div.style.color); // green </script> </body> </html>