INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

center-align menu item text

center-align menu item text

(OP)
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="http://www.w3.org/1999/xhtml">
<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> 

RE: center-align menu item text

This is a question for the CSS forum: forum215: HTML, XHTML & CSS
Also, when you post there, post the HTML that is output to the browser

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close