JSFiddle - React, Tailwind, and code Playground
by Zer00ne Null
HTML
<body>
<div class='svg'>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" width="48" height="48">
<svg id="icon-ellipsis" class="icon-ellipsis" width="100%" height="100%" viewBox="0 0 24 24">
<path class="icon-ellipsis-dot" d="M6 11.59c0 1.105-0.895 2-2 2s-2-0.895-2-2c0-1.105 0.895-2 2-2s2 0.895 2 2z"></path>
<path class="icon-ellipsis-dot" d="M14 11.59c0 1.105-0.895 2-2 2s-2-0.895-2-2c0-1.105 0.895-2 2-2s2 0.895 2 2z"></path>
<path class="icon-ellipsis-dot" d="M22 11.59c0 1.105-0.895 2-2 2s-2-0.895-2-2c0-1.105 0.895-2 2-2s2 0.895 2 2z"></path>
</svg>
</svg>
</div>
<!-- above is the sprite sheet -->
<div id="wrapper">
<svg style="height: 100%;width:100%">
<use xlink:href="#icon-ellipsis"></use>
</svg>
</div>
<div id="div">
Testing Div not svg.
</div>
</body>
CSS
#wrapper {
height: 48px;
width: 48px;
}
#div {
width: 50px
height: 50px
background-color: lightcoral;
}
.svg {
position:relative;
left:-999px;
}
JavaScript
var firstDot = document.querySelector("#icon-ellipsis > path:nth-child(2)")
firstDot.style.transition = "all 0.4s ease";
firstDot.style.transform = "translateY(-5px)";
//why does it not slide into translateY(-5px;)
var div = document.getElementById("div");
div.style.transition = "all 0.4s ease";
div.style.transform = "translateY(10px)";
//div works fine, slides into place.