JSFiddle - React, Tailwind, and code Playground
HTML
<div class="tankWidget">
<div class="banner">Tank 1: Kero</div>
<div id="container">
<div id="frame">
<div class="strip">
<div class="a">50% Full</div>
<div class="b"></div>
<div class="c"></div>
<div class="d"></div>
<div class="e"></div>
<div class="f">T</div>
<div class="g">H</div>
<div class="h">I</div>
<div class="i">S</div>
<div class="j"></div>
<div class="k">I</div>
<div class="l">S</div>
<div class="m"></div>
<div class="n">C</div>
<div class="o">O</div>
<div class="p">O</div>
<div class="q">L</div>
<div class="r">!</div>
<div class="s"></div>
<div class="t"></div>
<div class="u"></div>
<div class="v"></div>
<div class="w"></div>
<div class="x"></div>
</div>
</div>
</div>
<table id="specTab1">
<tr><th>Volume:</th><td>50L</td></tr>
<tr><th>Capacity:</th><td>100L</td></tr>
<tr><th>Ullage (AL):</th><td>1.24</td></tr>
<tr><th><br /></th></tr>
</table>
<div class="widget-footer"></div>
</div>
CSS
.tankWidget{
position:relative;
width:45%;
height:400px;
float:left;
background-color:#c4c4c4;
margin:1.5%;
}
.banner{
min-height:40px;
width:100%;
background-color:#383838;
color:#ececec;
margin:0;
}
.widget-footer{
min-height:40px;
width:100%;
background-color:#383838;
bottom:0;
position:absolute;
color:#ececec;
}
#specTab1 {
position: absolute;
bottom: 50px;
}
#container {
margin:0;
margin-top:-50px;
width:100%;
padding:0;
-moz-perspective: 1000px; /*required to make cylinder shape*/
-webkit-perspective: 1000px;
}
#frame {
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
-moz-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translate3d(0px, 70px, 0px);
-webkit-transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) translate3d(-15px, 70px, 0px);
transition: none;
margin: 0 50%;
}
#frame:hover {
-moz-transform: rotateX(0deg) rotateY(-360deg) rotateZ(0deg) translate3d(0px, 70px, 0px);
-webkit-transform: rotateX(0deg) rotateY(-360deg) rotateZ(0deg) translate3d(-15px, 70px, 0px);
transition: all 5s;
}
.strip {
-moz-transform-style: preserve-3d;
-webkit-transform-style: preserve-3d;
}
.strip div {
position: fixed;
background: blue;
background-repeat:repeat;
border-width: thin 10px;
transition: all .2s;
height:120px; /*height and width of tank display*/
width:34px;
border-top:1px solid black;
border-bottom:1px solid black;
text-align: center;
font-family: Arial;
padding-top: 40px;
font-weight: bold;
color: #f00;
}
.strip div.a:before {
background-color: #ff0;
}
.strip div:before {
border-bottom:2px solid black;
content:"";
position: absolute;
z-index: -1;
/*Make this lower so any text appears in front*/
top: 0;
right: 0;
bottom: 50%; /*used for tank level setting*/
left: 0;
...
JavaScript
function resize3d() {
var container = document.getElementById('container');
w = container.offsetWidth / 10;
z = container.offsetWidth / 30 * 11;
var grad = 0;
var alphabet = "abcdefghijklmnopqrstuvwx";
for(var i=0; i<alphabet.length; i++)
{
var letter = alphabet.charAt(i);
var el = document.querySelector(".strip ."+letter);
el.style.width = w+"px";
el.style.webkitTransform = "rotateY("+grad+"deg) translateZ("+z+"px)";
grad += 15;
}
}
window.onresize = function(event) {
resize3d();
};
resize3d();