CSS selector for disabled input type="submit"

CssCss SelectorsSubmit Button

Css Problem Overview


Is there a CSS selector for disabled input type="submit" or "button"?

Should I just use input[type="submit"][disabled]?

Does that work in IE6?

Css Solutions


Solution 1 - Css

>Does that work in IE6?

No, IE6 does not support attribute selectors at all, cf. CSS Compatibility and Internet Explorer.

You might find How to workaround: IE6 does not support CSS “attribute” selectors worth the read.


EDIT
If you are to ignore IE6, you could do (CSS2.1):

input[type=submit][disabled=disabled],
button[disabled=disabled] {
    ...
}

CSS3 (IE9+):

input[type=submit]:disabled,
button:disabled {
    ...
}

You can substitute [disabled=disabled] (attribute value) with [disabled] (attribute presence).

Solution 2 - Css

As said by jensgram, IE6 does not support attribute selector. You could add a class="disabled" to select the disabled inputs so that this can work in IE6.

Solution 3 - Css

I used @jensgram solution to hide a div that contains a disabled input. So I hide the entire parent of the input.

Here is the code :

div:has(>input[disabled=disabled]) {
    display: none;
}

Maybe it could help some of you.

Solution 4 - Css

This is in 2021. This is the css selector, which worked for me on Chrome and Edge (IE seems to be not supported any longer: https://blogs.windows.com/windowsexperience/2021/05/19/the-future-of-internet-explorer-on-windows-10-is-in-microsoft-edge/):

input[type=submit]:disabled {
    background-color: #4a4a4a;
}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFranciscView Question on Stackoverflow
Solution 1 - CssjensgramView Answer on Stackoverflow
Solution 2 - CssTimView Answer on Stackoverflow
Solution 3 - CssMelomanView Answer on Stackoverflow
Solution 4 - Cssgil.fernandesView Answer on Stackoverflow