Menus' hover style's Rendering depends on the sequence of the css

来源:互联网 发布:在线充值系统网站源码 编辑:程序博客网 时间:2024/06/03 05:57

As using "asp:Menu" control, the hover style for sub-menus is really very useful for making a good using experience.


But at first it makes me crazy,. I use the following codes:

<asp:Menu ...>

<DynamicHoverStyle CssClass="dhs">

...

<LevelMenuItemStyles>

     <asp:MenuItemStyle CssClass="FirstLevelMenu" />

     <asp:MenuItemStyle CssClass="SecondLevelMenu" />

    <asp:MenuItemStyle CssClass="ThirdLevelMenu" />

</LevelMenuItemStyles>

</asp:Menu>


The css content:

.FirstLevelMenu{..}

.SecondLevelMenu{..}

.dhs{ background-color:gray;}

.ThirdLevelMenu{...}

But the "dhs" style never  works on the third level menus.


Solution is changing the sequence of the style class "dhs" and "ThirdLevelMenu“:

.FirstLevelMenu{..}

.SecondLevelMenu{..}

.ThirdLevelMenu{...}

.dhs{ background-color:gray;}


原创粉丝点击