Skip to content

Instantly share code, notes, and snippets.

@IagoLast
Created April 2, 2018 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IagoLast/137e831dd1f7d065a4ccd2ec2b365407 to your computer and use it in GitHub Desktop.
Save IagoLast/137e831dd1f7d065a4ccd2ec2b365407 to your computer and use it in GitHub Desktop.
getComputedStyle
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>getComputedStyle for extracting rgb color</title>
</head>
<body>
<body>
<script>
var element = document.createElement('div');
element.style.color = 'aliceblue';
document.body.appendChild(element);
var style = getComputedStyle(element);
document.body.innerText = style.color;
</script>
</body>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment