We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


StaticMenuItemStyle Border Thickness

tekchic asked
Medium Priority
Last Modified: 2013-12-03
I would like a 1px border around my menus to make them stand out, but the borders multiply between menu items.

For example, if it's a 1px border, it's fine on top/sides/bottom, but in between the top menu item and the one below it, that border doubles to 2px.

Anyone know if there's an attribute I'm not setting?

Here's the code for my menu control.

<asp:Menu ID="Menu1" runat="server" BackColor="#fcfdf5" DynamicHorizontalOffset="2" Font-Names="Arial, Helvetica" Font-Size="11px" ForeColor="#666666" StaticSubMenuIndent="12px" Width="195px">
    <StaticMenuItemStyle BackColor="#F3F7DE" HorizontalPadding="5px" VerticalPadding="2px" BorderColor="#D3D9B5" BorderWidth="1" />
    <DynamicHoverStyle BackColor="#F3F7DE" ForeColor="Black" />
    <DynamicMenuStyle BackColor="#fcfdf5" />
    <StaticSelectedStyle BackColor="#F3F7DE" />
    <DynamicSelectedStyle BackColor="#F3F7DE" />
    <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="3px" />
        <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="Reconcilement" Value="Reconcilement" NavigateUrl="~/PageControls/Reconcilement.aspx"></asp:MenuItem>
        <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="Exception Management" Value="Exception Management" NavigateUrl="~/PageControls/ExceptionManagement.aspx"></asp:MenuItem>
        <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="Disputes" Value="Disputes" NavigateUrl="~/PageControls/Disputes.aspx">
            <asp:MenuItem ImageUrl="~/Graphics/nav_off.gif" Text="ATM" Value="ATM" NavigateUrl="~/PageControls/ATM.aspx"></asp:MenuItem>
    <StaticHoverStyle  Font-Underline="true" BackColor="#F3F7DE" ForeColor="Black" />
Watch Question

it's because you're setting the borderstyle on the menu items rather than the menu collection.


If I put it up on the <asp:Menu> tag, it puts a border around all the items, but not the item individually.  I'd like a border around each clickable menu, but not doubled size-wise in between items.  Is this possible?

Thanks for the quick response.  I'm really new to ASP.NET 2.0 nav controls.

does the menu control have a gridlines attribute? if so, you could just set GridLines="Horizontal".


None.  There is a CssClass attribute.  I might have to figure out how to use that and apply a stylesheet.  Seems like overkill.

better idea, use the border setting on the menu tag, then assign a CssClass to the items. call it menuitemstyle or something like that. then in your stylesheet:

      border-top: 1 Black;

this will put a line at the top of each menu item cell. you can also put all your font settings in there. definitely not overkill.


Apparently there's an attribute I overlooked: "SeparatorImageUrl" for each individual menu item.  I created a "line" and called that "bottomSep.gif", and that works for getting the lines in between each item.  It's *almost* what I'm looking for, but for now it'll do.

<asp:MenuItem SeparatorImageUrl="~/Graphics/bottomSep.gif" ImageUrl="~/Graphics/nav_off.gif" Text="Reconcilement" Value="Reconcilement" NavigateUrl="~/PageControls/Reconcilement.aspx"></asp:MenuItem>

Thanks for the help, craskin.  I tried making the border-top css class, but it didn't appear to pick it up in the browser.  It could be that the ASP.NET menu is overlaying the entire top level, maybe a z-index might fix it.

I guess for now I'll work with the "SeparatorImageUrl" on the <asp:MenuItem> element, and on the <asp:Menu> element I can use "StaticTopSeparatorImageUrl" to get the line going along the top of the menu.
PAQed with points refunded (250)

Community Support Moderator

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.