I am trying to style disabled state for div I have code
<div disabled> Welcome </div>
<style>
div:disabled{
background-color:#f1f1f1;
}
</style>
I don't have any class or ID present on the element. It is system generated. I want make the background color light gray.
Nope! Divs can't be disabled. Only form and form elems. Actually in Quirks-mode IE can disable a div , but it only grays button texts, it doesn't prevent events firing.
Create another div that sits on top of #message-box with an opacity of say, 50% and a background-color of gray. When you need to, just show this overlay div.
Just set contentEditable="false" . See this answer.
Try to use the Attribute Selector:
div[disabled]{}
See for more Information:
https://www.w3schools.com/css/css_attribute_selectors.asp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With