How to Add CSS Style to ASP.NET Menu Control

1st Step:

Place code below between <style> and </style>
.primaryStaticMenu
{
   background-color: transparent;
   float: right;
}
.primaryStaticMenuItem
{
   width: 10em;
   background-color: #f7f2ea;
   border-width: 1px;
   border-color: #efefef #aaab9c #ccc #efefef;
   border-style: solid;
   color: #777777;
   padding: 0.5em 0 0.5em 1em;
}


.primaryStaticHover
{
   color: #800000;
   background: #f0e7d7;
}

.primaryDynamicMenu
{  
   background-color: #f7f2ea;              
   border-bottom: solid 1px #ccc;   

.primaryDynamicMenuItem
{
   width: 10em;
   background-color: #f7f2ea;
   color: #777;
   padding: 0.5em 0 0.5em 1em;
   border-width: 1px;
   border-color: #f7f2ea #aaab9c #f7f2ea #efefef; 
   border-style: solid;        
}   
.primaryDynamicHover
{
   color: #800000;
   background: #f0e7d7;
}           

.secondaryLevelOne
{
   background-color: transparent;
   background-repeat: repeat-x;
   margin: 1.5em 0 0 0;
   padding: 5px 0 0 5px;
   width: 12em;
   height: 35px;
}
.secondaryLevelTwo
{
   background: #FAFBFB;
   padding: 5px 0 5px 5px;        
}
.secondaryStaticHover
{
   color: #800000;
}

2nd Step:

call CssClass for Menu Control between <asp:Menu ID="Menu5" runat="server" DataSourceID="SiteMap11"> and </asp:Menu> via code below:

<StaticMenuStyle CssClass="primaryStaticMenu"/>
<StaticMenuItemStyle CssClass="primaryStaticMenuItem"/>
<StaticHoverStyle CssClass="primaryStaticHover"/>  
<DynamicMenuStyle CssClass="primaryDynamicMenu" />    
<DynamicMenuItemStyle CssClass="primaryDynamicMenuItem"/>
<DynamicHoverStyle CssClass="primaryDynamicHover"/>

Share this

Related Posts

Previous
Next Post »