Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

center-align menu item text

Status
Not open for further replies.

AzizKamal

Programmer
Apr 6, 2010
122
PK
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:

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>
 
This is a question for the CSS forum: forum215
Also, when you post there, post the HTML that is output to the browser
 
Thanks.

I posted it on the CSS forum with the HTML that is output to the browser.
thread215-1769435
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top