JSFiddle - React, Tailwind, and code Playground

by digthedoug

HTML

<div class="outer">
    <div class="middle rotate">
        <div class="inner">Centered?</div>
    </div>
</div>

<div class="outer">
    <div class="middle">
        <div class="inner">Centered?</div>
    </div>
</div>

<div id='controls'>
    <p><b>Height:</b><br/>
        <input id='height' type="range" min=20 max=300 value=150 />
    </p>
</div>

CSS

.outer {
    display: table;
}

.middle {
    display: table-cell;
    vertical-align: middle;
}

.inner {
    margin-left: auto;
    margin-right: auto;
    /* width: 16px; */
}

.outer {
  background-color: pink;
  margin-right: 10px;
    float: left;
}

.inner {
  font-size: 13px;
  font-color: #878787;
}

.rotate {
  -webkit-transform: rotate(-90deg);
  -ff-transform: rotate(-90deg);
  transform: rotate(-90deg);
  width: 16px;  /* transform: rotate() does not rotate the bounding box. */
}

#controls {
    position: absolute;
    left: 200px;
    top: 10px;
    border: 1px solid gray;
    padding-left: 10px;
    padding-right: 10px;
    background: #f8f8f8;
}

JavaScript

$('#height').on('change', function(e) {
    $('.outer').css('height', $('#height').val() + 'px');
});
$('#height').trigger('change');