Skip to content

Instantly share code, notes, and snippets.

@joakin
Created August 20, 2014 11:38
Show Gist options
  • Save joakin/27f436a3275216c9f171 to your computer and use it in GitHub Desktop.
Save joakin/27f436a3275216c9f171 to your computer and use it in GitHub Desktop.
css chorizo chess board checkers style
/*
different types of grids with no formula nor logic styled as a chess board...
all layout logic and colors are handled in css. In html is just
<div class='irServers-XXX'>
<div class='irServer'>Oh hai</div>
<div class='irServer'>Oh hai</div>
<div class='irServer'>Oh hai</div>
...
</div>
*/
.irServers>.irServers-0 { background-color: transparent; }
/* 2 row 2 col = 4 cells */
.irServers-4 .irServer { width: 50%; }
/* 2 row 3 col = 6 cells */
.irServers-6 .irServer { width: 33.33%; }
/* 2 row 4 col = 8 cells */
.irServers-8 .irServer { width: 25%; }
/* 3 row 3 col = 9 cells */
.irServers-9 .irServer { width: 33.33%; }
/* 3 row 4 col = 12 cells */
.irServers-12 .irServer { width: 25%; }
/* 4 row 4 col = 16 cells */
.irServers-16 .irServer { width: 25%; }
/* Server colors ... */
.irServers-4 .irServer:nth-child(4n+1),
.irServers-4 .irServer:nth-child(4n),
.irServers-6 .irServer:nth-child(6n+1),
.irServers-6 .irServer:nth-child(6n+3),
.irServers-6 .irServer:nth-child(6n-1),
.irServers-9 .irServer:nth-child(6n+1),
.irServers-9 .irServer:nth-child(6n+3),
.irServers-9 .irServer:nth-child(6n-1),
.irServers-8 .irServer:nth-child(8n+1),
.irServers-8 .irServer:nth-child(8n+3),
.irServers-8 .irServer:nth-child(8n),
.irServers-8 .irServer:nth-child(8n-2),
.irServers-12 .irServer:nth-child(8n+1),
.irServers-12 .irServer:nth-child(8n+3),
.irServers-12 .irServer:nth-child(8n),
.irServers-12 .irServer:nth-child(8n-2),
.irServers-16 .irServer:nth-child(8n+1),
.irServers-16 .irServer:nth-child(8n+3),
.irServers-16 .irServer:nth-child(8n),
.irServers-16 .irServer:nth-child(8n-2),
.omg-wtf-have-i-done {
background-color: rgb(214, 240, 181);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment