JSFiddle - React, Tailwind, and code Playground

by Justin Maat

HTML

<svg width="400" height="110">
  <rect width="300" height="100" style="fill:rgb(0,0,255)" />
</svg>

JavaScript

var svg = document.getElementsByTagName("svg")[0];
var rect = document.getElementsByTagName("rect")[0];

console.log(svg);
console.log(rect);

var svgStyles = getComputedStyle(svg);
var rectStyles = getComputedStyle(rect);

console.log(svgStyles['width']);
console.log(rectStyles['width']);