How to style Disabled Options in a form

后端 未结 8 1648
不思量自难忘°
不思量自难忘° 2020-12-10 10:39

I\'m using a form with a drop-down menu that contains some options disabled, so the users cannot select them. I\'m trying to customize via css these elements but I have some

8条回答
  •  悲&欢浪女
    2020-12-10 11:10

    I used :invalid to solve my issue, description below:

    So these answers do style the disabled option but only within the dropdown. Not if you wanted to display the disabled option at the top of the list as a "Please select".

    Hope this helps others having a similar issue to what I had.

    Basically, the select needs to be a required field for this to work:

    
                            
        
    提交评论

提交回复
热议问题