CSS for hover that includes all child elements

后端 未结 4 634
走了就别回头了
走了就别回头了 2020-12-30 22:05

I have a draggable div element with a hover style. This works fine, but the div contains some form elements (label, input). The problem is that when the mouse is over these

相关标签:
4条回答
  • 2020-12-30 22:40

    This isn't a css answer, but it might still be useful to you.

    Someone else already suggested that you might have to resort to javascript for browser compatibility. If you do resort to javascript, you can use the jquery library to make it easy.

    $(".appsetting").hover(hoverInFunc,hoverOutFunc);

    This sets an event handler for hovering into and out of the selected element(s) as matched by the css style selector in the $() call.

    0 讨论(0)
  • 2020-12-30 22:42

    At least 2 ways of doing it:

    • hover states for each child, either explicitly or with * selector, as suggested by garrow .class *:hover
    • cascade hover state to children .class:hover *

    There are probably others

    0 讨论(0)
  • 2020-12-30 22:57
    .app_setting *:hover { cursor:move }
    
    0 讨论(0)
  • 2020-12-30 23:03

    You might have to resort to JS to make it happen for IE6.

    0 讨论(0)
提交回复
热议问题