How can I get the inline style of a custom CSS var from an element?
I can easily get the width or any other traditional styles but get an error when I try to get the custom inline style. Is there a way to extract this style data? Thank you in advance for any help provided. No jQuery Please.
var styleDivWidth = document.getElementById('myId').style.width;
console.log(styleDivWidth);
/*
var styleDivRotation = document.getElementById('myId').style.--rotation;
console.log(styleDivRotation);
*/
.myClass{
background-color:red;
float:left;
--rotation: 45deg;
transform: rotate(var(--rotation));
margin:20px;
}
<div id="myId" class="myClass" style="width:100px; height:100px;
--rotation:-45deg;">