JSFiddle - React, Tailwind, and code Playground

by aflynt

HTML

Centering example:
<div id="container">
  <div id="content">
    Line 1
  </div>
</div>

CSS

body {
  font: 36px Arial, sans-serif;
}

#container {
  color: white;
  background: #ffbd17;
  width: 400px;
  height: 260px;
}

#content {
  background: #06c;
  width: 120px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

JavaScript

(function() {
  var toggle = true;
  setInterval(function() {
    if (toggle) {
      $("#content").html("Line 1");
    } else {
      $("#content").html("<div>Line 1</div><div>Line 2</div>");
    }
    toggle = !toggle;
  }, 1300);
}());