I guess there is something obviously wrong with this:
var elem = document.getElementById("homepage-mobile-cat1");
console.log(elem);
var test1 = elem.style("margin-left");
var test2 = elem.css("margin-left");
This returns elem.style or elem.css function does not exist.
The output of console.log is
<div id="homepage-mobile-cat1" class="container homepage-mobile-cat red-background-mobile" style="margin-left: 0 !important;">
<a href="http://www.example.co.uk/literacy/">
<div class="CSSTable homepage-cat-text" style=""><p><span style="width:80%; display:block !important;margin:0 auto;"> Literacy Resources</span></p></div> <!-- CSSTable homepage-cat-text -->
</a>
</div>