center menu within the 960 grid
Posted
by
Kyle Monti
on Stack Overflow
See other posts from Stack Overflow
or by Kyle Monti
Published on 2012-04-15T03:48:38Z
Indexed on
2012/04/15
5:28 UTC
Read the original article
Hit count: 191
I have been working on 960 grid,(http://960.gs/) and I used an old style menu i've used in the past from a few years ago and for some reason with the 960 grid, the menu is floating left and I want it centered.
ul#menu {
width:940px;
height:61px;
background: url(../images/menu_bg.png) no-repeat;
list-style:none;
padding-top:0;
padding-left:0;
margin: 0;
}
ul#menu li {
float:left;
}
ul#menu li a {
background: url(../images/menu_splice_color.png) no-repeat scroll top left;
display:block;
height:61px;
position:relative;
}
ul#menu li a.shel {
width:135px;
}
ul#menu li a.golf {
width:84px;
background-position:-135px 0px;
}
ul#menu li a.pro {
width:119px;
background-position:-219px 0px;
}
ul#menu li a.event {
width:94px;
background-position:-338px 0px;
}
ul#menu li a.member {
width:148px;
background-position:-432px 0px;
}
ul#menu li a.bistro {
width:91px;
background-position:-580px 0px;
}
ul#menu li a.contact {
width:115px;
background-position:-671px 0px;
}
ul#menu li a span {
background: url(../images/menu_splice_color.png) no-repeat scroll bottom left;
display:block;
position:absolute;
top:0;
left:0px;
height:100%;
width:100%;
z-index:100;
}
ul#menu li a.shel span {
background-position:0px -61px;
}
ul#menu li a.golf span {
background-position:-135px -61px;
}
ul#menu li a.pro span {
background-position:-219px -61px;
}
ul#menu li a.events span {
background-position:-338px -61px;
}
ul#menu li a.member span {
background-position:-432px -61px;
}
ul#menu li a.bistro span {
background-position:-580px -61px;
}
ul#menu li a.contact span {
background-position:-672px -61px;
}
and my generic html markup is
<div class="container_16">
<!-- Navigation Start -->
<div class="grid_16">
<ul id="menu">
<li><a href="#" class="shel"><span></span></a></li>
<li><a href="#" class="golf"><span></span></a></li>
<li><a href="#" class="pro"><span></span></a></li>
<li><a href="#" class="events"><span></span></a></li>
<li><a href="#" class="member"><span></span></a></li>
<li><a href="#" class="bistro"><span></span></a></li>
<li><a href="#" class="contact"><span></span></a></li>
</ul>
</div>
<div class="clear"></div>
</div>
And I use jquery animations to roll over the images.
$(function() {
$("ul#menu span").css("opacity","0");
$("ul#menu span").hover(function () {
$(this).stop().animate({
opacity: 1
}, "slow");
},
function () {
$(this).stop().animate({
opacity: 0
}, "slow");
});
});
© Stack Overflow or respective owner