Skip to content

Instantly share code, notes, and snippets.

@blainsmith
Created January 14, 2015 13:26
Show Gist options
  • Save blainsmith/b65758595489f6ccf9d3 to your computer and use it in GitHub Desktop.
Save blainsmith/b65758595489f6ccf9d3 to your computer and use it in GitHub Desktop.
CSS Gridlines
/**
* CSS Gridlines
*/
body {
background-color: #000;
}
ul {
margin: 0 auto;
padding: 0;
width: 600px;
/* Number of columns in the grid */
-webkit-columns: 3;
-moz-columns: 3;
columns: 3;
/* Add vertical borders between each column */
-webkit-column-rule: 1px solid #fff;
-moz-column-rule: 1px solid #fff;
column-rule: 1px solid #fff;
/* Remove the gap so the border lines touch */
-webkit-column-gap: 0;
-moz-column-gap: 0;
column-gap: 0;
}
li {
/* Center everything inside each item */
text-align: center;
/* Add a bottom border to each item */
border-bottom: 1px solid #fff;
}
/* This should be the expected number of items in each
column since it removes the border from the last on in
each column. */
li:nth-child(3n) {
border-bottom: none;
}
<ul>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
<li><img src="http://placeskull.com/170/170" /></li>
</ul>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment