Managed to fix the CSS bug for good.

Setting element.style directly was folly.