Skip to content

Instantly share code, notes, and snippets.

@ahvonenj
Last active August 29, 2015 14:24
Show Gist options
  • Save ahvonenj/634d43e29ca0c13f09d6 to your computer and use it in GitHub Desktop.
Save ahvonenj/634d43e29ca0c13f09d6 to your computer and use it in GitHub Desktop.
Quick x * y table
*
{
margin: 0;
padding: 0;
}
html, body
{
width: 100%;
height: 100%;
font-family: Roboto, Consolas, Courier New, Tahoma, Arial;
}
#grid
{
width: 400px;
height: 400px;
border-spacing: 4px;
position: absolute;
left: 75px;
top: 75px;
}
#grid td
{
border: 1px solid black;
background-color: rgba(52, 152, 219, 0.6);
}
<table id = "grid">
</table>
var $grid = $('#grid');
var rows = 10;
var cols = 10;
var rowsncols = '';
for(var i = 0; i < rows; i++)
{
rowsncols += '<tr>';
for(var j = 0; j < cols; j++)
{
rowsncols += '<td>&nbsp;</td>';
}
rowsncols += '</tr>';
}
$grid.append(rowsncols);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment