How do you style disabled textarea in IE8?

后端 未结 2 1679
温柔的废话
温柔的废话 2020-12-03 14:30

What rule do you need to enable styling of disabled elements in IE8? I have the code below now. It that works fine under IE7, but not on IE8. IE8 just give me plaint wihte b

相关标签:
2条回答
  • 2020-12-03 14:46

    the :pseudo class in the selector is tripping up IE8!

    you have to ungroup these selectors if you absolutely have to use those CSS3 pseudo classes;

    If there's a selector in the ruleset that IE8 doesn't understand it's ignoring the whole thing - this is common in IE8 with CSS3 pseudo classes

    e.g. If you separate them out and remove the pseudo :disabled parts of the selector completely - you'll see the first example below works for all, whereas the second one still works except for IE7

    input[disabled], select[disabled], textarea[disabled] {background-color: #0f0;} /* lime green - works in IE7+ and modern browsers */
    
    input[disabled="disabled"], select[disabled="disabled"], textarea[disabled="disabled"] {background-color:#ff0;} /* yellow -  IE8+ and modern browsers */
    

    the color (as opposed to background-color) issue pointed at in another answer is not the cause of your issue, but it wouldn't help if you were also trying to change the color ;)

    0 讨论(0)
  • 2020-12-03 14:46

    Another option is to add a disabled class and style it:

    input.disabled, textarea.disabled{ 
        background:#EBEBE4; 
    }
    
    0 讨论(0)
提交回复
热议问题