How to style a HTML label for disabled input

后端 未结 5 1105
遇见更好的自我
遇见更好的自我 2020-12-29 03:16

I would like the labels for my form elements to be greyed out if the input is disabled and am not able to get it to work for text inputs. I have tried the following:

<
5条回答
  •  悲&欢浪女
    2020-12-29 03:37

    You can use atribute selectors in CSS, example https://jsfiddle.net/8pp6mpp5/1/

    Html


    `

    CSS

    label[disabled="disabled"]{
        background-color: #AAA;
    }
    

提交回复
热议问题