Skip to content

Instantly share code, notes, and snippets.

@Rplus
Created April 12, 2014 16:53
Show Gist options
  • Save Rplus/10545587 to your computer and use it in GitHub Desktop.
Save Rplus/10545587 to your computer and use it in GitHub Desktop.
A Pen by Rplus.
<div class="wrap">
<nav>
<a>111</a>
<a>222</a>
<a>333</a>
</nav>
</div>
/*
Horizontally Centered Menus with no CSS hacks
( float center! )
# Applicable timing:
* non-bgc/bgi on nav, just centering items~
http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support
*/
body {
background-image: linear-gradient( to right, #fff, #fff 50%, #000 50%, #000);
}
.wrap {
/* width: 100%; */
overflow: hidden;
padding: 10px 0;
background-color: #900;
}
nav {
float: left;
position: relative;
left: 50%;
padding: 10px 0;
background-color: #333;
box-sizing: border-box;
}
a {
float: left;
position: relative;
right: 50%;
padding: 10px;
background-color: pink;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment