Horizontally Centered Menus with no CSS hacks ( float center! )
- non-bgc/bgi on nav, just centering items~
http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support
Horizontally Centered Menus with no CSS hacks ( float center! )
http://matthewjamestaylor.com/blog/beautiful-css-centered-menus-no-hacks-full-cross-browser-support
<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; | |
} |