Skip to content

Instantly share code, notes, and snippets.

@oksushi
Created September 20, 2012 07:10
Show Gist options
  • Save oksushi/3754361 to your computer and use it in GitHub Desktop.
Save oksushi/3754361 to your computer and use it in GitHub Desktop.
Using display: table-cell to evenly determine widths. You can add an arbitrary number of <li>
/**
* Using display: table-cell to evenly determine widths. You can add an arbitrary number of <li>
*/
ul {
padding: 0;
display: table;
width: 100%;
background: hotpink;
table-layout: fixed;
border-spacing: 1em;
}
li {
display: table-cell;
}
a {
display: block;
padding: 1em;
text-align: center;
background: white;
}
a:hover {
background: lime;
}
<ul>
<li><a href="http://google.com">Item</a></li>
<li><a href="http://google.com">Item</a></li>
<li><a href="http://google.com">Item</a></li>
<li><a href="http://google.com">Item</a></li>
<li><a href="http://google.com">Item</a></li>
<li><a href="http://google.com">Item</a></li>
</ul>
{"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