Oh, I thought you were just wanting to style the body with CSS. Well, after your last comment, I went back and looked at your original JS code and saw the problem:
body is a tag, not an id. Codepen will in fact allow you to style the body with JS and there are two ways to do it:
getElementsByTagName returns a nodelist of elements with the given tag name. Or you can select an element from the list the same way you would from an array. There should be only 1 body, so get the first and only body tag with
That’s all good to know, but I’d rather just use the much simpler
Either one will work in place of
document.getElementById("grid-wrapper") in your JS code, just fyi.
edit: Ah! I overlooked the most obvious method:
But still, nothing beats