CodePen

HTML

            
              
            
          
!

CSS

            
              td, th {
  padding: 10px;
  border: 1px solid #ccc;
}
body {
  padding: 1rem;
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              var table = document.createElement('table'),
    tbody = document.createElement('tbody'),
    i, rowcount;

table.appendChild(tbody);

for (i = 0; i <= 3; i++) {
  tbody.insertRow(i);
  for (x = 0; x <= 2; x++) {
    tbody.rows[i].insertCell(x);
    tbody.rows[i].cells[x].appendChild(
        document.createTextNode('Row ' + i + ', Col ' + x)
    );
  }
}

table.createCaption();
table.caption.appendChild(
  document.createTextNode('A DOM-generated Table')
);

document.body.appendChild(table);
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................