JSFiddle - React, Tailwind, and code Playground

HTML

<div id="a"></div>
<div id="b"></div>
<div id="c"></div>

CSS

#a {
            width: 50px;
            height: 50px;
            background-color: blueviolet;
            margin-left: 150px;
        }
        #b {
            width: 50px;
            height: 50px;
            background-color: black;
            margin-top: 0px;
        }
        #c {
            width: 50px;
            height: 50px;
            background-color: rgba(45, 172, 35, 0.99);
            margin-top: 0px;
        }

JavaScript

var left = window.getComputedStyle(a).marginLeft;
    b.style.marginLeft = left;
    var cLeft = a.offsetLeft;
    c.style.marginLeft = cLeft + 'px';
    alert(left);
    alert(cLeft);