JSFiddle - React, Tailwind, and code Playground

by Bryan H

HTML

<h1>Lorem Ipsum</h1>
<img id="image_0" class="kit" src="http://placekitten.com/g/300/200" />

CSS

.kit {
    top: .45em;
    border: .85em blue inset;
}

JavaScript

var element, style, top;

// This line will fail if there is no element with the given ID.
element = document.getElementById('image_1');

try {
    style = window.getComputedStyle(element),
    top = style.getPropertyValue('top');
} catch( e ) {
    alert( "Exception [" + e + "]" );
    top = "error";
}

alert(" Top [" + top + "]" );