Created
April 2, 2018 11:23
-
-
Save IagoLast/137e831dd1f7d065a4ccd2ec2b365407 to your computer and use it in GitHub Desktop.
getComputedStyle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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