My current code creates a grid with span elements that have a class name of gridsquare. I'm trying to figure out how to apply styling to all of them. I keep getting the error TypeError: size.style is undefined. I have the function set to run after the elements are created, not sure what's going on...
let n=16;
let boxSize = 720/n;
function grid(){
  for(var i = 1; i < n; i++) {
    document.getElementById('container').innerHTML+='<div class="row">'
    for(k = 0; k < n; k++) {
       document.getElementById('container').innerHTML+='<span class="gridsquare">as</span>'; 
    } 
  }
  gridSize() 
}
function gridSize(){
  let size = document.getElementsByClassName("gridsquare")
    size.style.height = boxSize;
    size.style.width = boxSize; 
}
grid()
 
     
    