Matt R Matt R - 1 month ago 10
ASP.NET (C#) Question

How do I apply css to second level menu items?

I have a menu running off of a sitemap which one of the SiteMapNode looks like this:

<siteMapNode title="Gear" description="" url="">
<siteMapNode title="Armor" description="" url="~/Armor.aspx" />
<siteMapNode title="Weapons" description="" url="~/Weapons.aspx" />
</siteMapNode>


I also have a Skin applied to the asp:menu which uses the following css definition:

.nav-bar {
z-index: 2;
margin-top: -5%;
position: absolute;
top: 281px;
font-family: Jokewood;
font-style: italic;
}


When I run the website and mouseOver the Gear link, the Jokewood font is not applied to those items, how can I apply the css to the Armor and Weapons titles?

Update

I should of mentioned that the font is displayed correctly on all non-nested siteMapNodes.

Answer Source

You should bind styles like this (for both static and dynamic menu items):

<asp:Menu ID="Menu1" runat="server" >
    <StaticMenuStyle CssClass="nav-bar" />
    <DynamicMenuStyle CssClass="nav-bar" />
</asp:Menu>