Styling a disabled input with css only

前端 未结 3 1664
北恋
北恋 2020-12-16 10:29

I have sort of a strange situation. I\'m trying to style a disabled input button because I have an annoying hover turning the text to white. This makes it confusing to the

3条回答
  •  南笙
    南笙 (楼主)
    2020-12-16 10:59

    A space in a CSS selector selects child elements.

    .btn input
    

    This is basically what you wrote and it would select elements within any element that has the btn class.

    I think you're looking for

    input[disabled].btn:hover, input[disabled].btn:active, input[disabled].btn:focus
    

    This would select elements with the disabled attribute and the btn class in the three different states of hover, active and focus.

提交回复
热议问题