How to style an asp.net menu with CSS

前端 未结 11 1256
囚心锁ツ
囚心锁ツ 2020-11-30 00:36

I\'m in the process of styling an asp.net menu and I\'m trying to understand the meaning of the StaticSelectedStyle-CssClass and StaticHoverStyle-CssClass parameters.

<
11条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-30 01:16

    The thing to look at is what HTML is being spit out by the control. In this case it puts out a table to create the menu. The hover style is set on the TD and once you select a menu item the control posts back and adds the selected style to the A tag of the link within the TD.

    So you have two different items that are being manipulated here. One is a TD element and another is an A element. So, you have to make your CSS work accordingly. If I add the below CSS to a page with the menu then I get the expected behavior of the background color changing in either case. You may be doing some different CSS manipulation that may or may not apply to those elements.

    
    

提交回复
热议问题