JSFiddle - React, Tailwind, and code Playground

by dru_zod

HTML

<div>
<div id="a" class="a">
<div id="c1" class="c">
</div>
</div>
<div id="b" class="b">
<div id="c2" class="c">
</div>
</div>
</div>

CSS

.a, .b {
  height: 100px;
  background-color: lightblue;
  border: solid 1px green;
}

.c {
  background-color: yellow;
  border: solid 1px red;
  height: 100px;
}

.b {
  display: none;
}

JavaScript

var c1 = document.getElementById('c1');
var c2 = document.getElementById('c2');

console.log(c1.offsetHeight);
console.log(c2.offsetHeight);