I am using Visual Studio 2010 Professional.
I created a web form showing menu items that allow the user to go to another aspx page. For this purpose, I used Menu control from the Navigation section in the Toolbox.
The menu appears fine in the browser. However, the text of the MenuItem is aligned left on the screen. I need to show the text of each menu item aligned center on the screen. The Orientation property of Menu1 is set to Vertical. I have entered CSS code for text-align:center and also set <StaticMenuItemStyle CssClass="Menu" />. But still, the menu options are shown left aligned on the screen. The following menu options are displayed on the screen:
Add New Department (need it centered on the screen)
Add New Location (need it centered on the screen)
Enter Details (need it centered on the screen)
The code written is as follows:
I created a web form showing menu items that allow the user to go to another aspx page. For this purpose, I used Menu control from the Navigation section in the Toolbox.
The menu appears fine in the browser. However, the text of the MenuItem is aligned left on the screen. I need to show the text of each menu item aligned center on the screen. The Orientation property of Menu1 is set to Vertical. I have entered CSS code for text-align:center and also set <StaticMenuItemStyle CssClass="Menu" />. But still, the menu options are shown left aligned on the screen. The following menu options are displayed on the screen:
Add New Department (need it centered on the screen)
Add New Location (need it centered on the screen)
Enter Details (need it centered on the screen)
The code written is as follows:
Code:
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head runat="server">
<title>Application Main Menu</title>
<style type="text/css">
.Menu td a
{
text-align:center;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<uc1:Header ID="Header1" runat="server" />
<h1 align="center"><span lang="en-us">Main Menu</span></h1>
<asp:Menu ID="Menu1" runat="server">
<Items>
<asp:MenuItem NavigateUrl="department.aspx" Text="Add New Department<br></br>" Value="Department">
</asp:MenuItem>
<asp:MenuItem NavigateUrl="location.aspx" Text="Add New Location<br></br>" Value="Location">
</asp:MenuItem>
<asp:MenuItem NavigateUrl="details.aspx" Text="Enter Details<br></br>" Value="Detail">
</asp:MenuItem>
</Items>
<StaticMenuItemStyle CssClass="Menu" />
</asp:Menu>
</form>
</body>
</html>