horizontally center asp menu

Posted by Sharpcnet under CSS 3 on 12/18/2013 | Points: 10 | Views : 8803 | Status : [Member] | Replies : 2
I am unable to centre the menu bar horizontally. The no. of main menu items may inc./Dec. with each user login. This code makes the menu bar start at like 30% from the left.
Tried display:inline-block and display:table for #menuContainer.

If there are 5 main menu items and I set the width of #menuContainer to 30%, it appears centred.

ASPX:

<div id="divMenu">
<div id="menuContainer">
<asp:Menu id ="menuBar" runat="server" Orientation="Horizontal"
IncludeStyleBlock="false">
<item>
<asp:MenuItem Text="Home"></asp:MenuItem>
<asp:MenuItem Text="Folio">
<asp:MenuItem Text="Nature"></asp:MenuItem>
<asp:MenuItem Text="People">
<asp:MenuItem Text="Tribe"></asp:MenuItem>
</asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Contact"></asp:MenuItem>
</items>
</asp:Menu>
</div>
</div>
CSS:

#divMenu
{
position:fixed;
left:0;
top:7%;
z-index:2;
width:100%;
height:5%;
}
#menuContainer
{
width:50%;
margin:0 auto;
}
#menuBar
{
position:fixed;
top:5.3%;
}
#menuBar ul
{
list-style:none;
background-color:silver;
padding:0 5px;
}





Responses

Posted by: vishalneeraj-24503 on: 12/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://forums.asp.net/t/1392772.aspx
http://www.telerik.com/community/forums/aspnet-ajax/menu/centering-a-menu-horizontally.aspx
http://www.codeproject.com/Questions/616370/ASP-NET-Menu-Controller-move-to-the-the-center

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://bytes.com/topic/asp-net/answers/818233-dynamic-menu-centering
http://www.dreamincode.net/forums/topic/226769-centering-of-asp-menu-items/
http://www.dreamincode.net/forums/topic/130893-align-horizontal-menu-from-tutorial-in-centre-of-page/

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response