I am trying to style the disabled state for a div. I have code
<div disabled> Welcome </div> <style> div:disabled{ background-color:#f1f1f1; } </style>
I do not have a class or identifier present in the element. It is generated by the system. I want to make the background color light gray.
Try using the attribute selector:
div[disabled]{}
See additional information:
https://www.w3schools.com/css/css_attribute_selectors.asp
This can be achieved using attribute selectors, in this case, "disabled" - this attribute:
attribute selectors
div[disabled] { background-color: #f1f1f1; }
, MDN
, .
In a div, disabledis an attribute. Therefore, use the attribute selector.
disabled
<div disabled> Welcome </div> <style> div[disabled] { background-color:#f1f1f1; } </style>
https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors
css for attribute
div[disabled]{ background-color:#f1f1f1; }
Source: https://habr.com/ru/post/1676829/More articles:Angular2 browser back button after redirect - redirectHow to rename a service created by the @ Angular / cli command using the command - angularOverloading the increment operator in C ++ Generic Programming - c ++How to correctly define Node.js functions and properties for Prepack? - javascriptAndroid O Background service runs for more than 30 minutes. What for? - androidHow to create a list containing a list of different types - c #Should the container component * always * connect to Redux? - javascriptWhy does null increase the length of an array, even if it represents an empty value? - javascriptCompiling an unexpected .NET Core project dependency - c #How to transfer the first change in the value of a variable between years, for each group? - loopsAll Articles