Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I apply some css for all readonly elements on focus in IE8?

I want to apply some css for all readonly elements on focus and I don't know how to do that in IE8. For firefox,chrome,opera it works but IE8 wont to see this:

(background:#F8F8F8 !important;  outline:none !important;)

Is very strange and I don't understand why the opacity is applied in even in IE8 and background, outline are not applied.

*[readonly]{
  opacity: 0.5;
  filter:progid:DXImageTransform.Microsoft.Alpha(opacity=55);
  box-shadow:none !important;
  -webkit-box-shadow:none !important;
  background:#F8F8F8 !important;
  outline:none !important;
  }

If someone can help, thank's.

like image 757
mcmwhfy Avatar asked Oct 14 '25 07:10

mcmwhfy


1 Answers

If you want it to be applied on focus, perhaps you should include the :focus pseudo-class. If that works the next step is to get rid of all those !importants unless you really, really need them:

[readonly]:focus {
  opacity: 0.5;
  filter: progid:DXImageTransform.Microsoft.Alpha(opacity=55);
  box-shadow: none;
  -webkit-box-shadow: none;
  background: #F8F8F8;
  outline: none;
}
like image 137
BoltClock Avatar answered Oct 18 '25 02:10

BoltClock



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!