Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disabled styling for DIV element [duplicate]

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.

like image 488
Nitin Shinde Avatar asked May 10 '17 10:05

Nitin Shinde


People also ask

Can a div have disabled attribute?

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.

How do I make DIVS greyed out?

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.

How do I turn off contentEditable div?

Just set contentEditable="false" . See this answer.


1 Answers

Try to use the Attribute Selector:

div[disabled]{}

See for more Information:

https://www.w3schools.com/css/css_attribute_selectors.asp

like image 132
Wolfgang Blessen Avatar answered Oct 10 '22 08:10

Wolfgang Blessen