简体   繁体   中英

CSS Working Different in Chrome and IE 8

I have this CSS class that is working fine in Chrome, but in IE 8(yes my work still uses IE 8) the background image isn't showing up. I am thinking that IE 8 may not know what to do with some part of the CSS but haven't been able to pin point it.

Here is the CSS class

ul.action:not(.btnImage) li a:not(.btnImage), ul.groupAction:not(.btnImage) li a:not(.btnImage),  ul.actionGradient:not(.btnImage) li a:not(.btnImage){
background-color: transparent !important;
background: url("../images/buttons/btnShineBackground.png") top left repeat-x !important;
border-width: 0px 1px !important;
border-color: #f47a2a !important;
border-style: ridge !important;
padding: 0px !important;
color: #FFF !important;
width: 120px !important;
height: 29px !important;
text-align: center !important;
vertical-align: middle !important;
line-height: 29px !important;
font-size: 10px !important;
font-weight: lighter !important;
font-family: Arial Black !important;
font-style: normal !important;
text-transform: uppercase !important;

And here is the HTML

<ul class=" action"><li><a href="javascript:void(0);" onmousemove="window.status='';"     onmouseout="window.status='';" id="r898BB6A34E694110894F489DA4BEA3BB1DE_3" onfocus="storeFocusField(this);" onclick="customOnClick(this);submitAjax(this,'PageContainer','a_r898BB6A34E694110894F489DA4BEA3BB1DE_3','0','','','','N','',null,'');">Continue</a></li></ul>

Very simple: You're using CSS features in your selectors that are not supported in IE8.

IE8 does not support CSS :not() . Therefore your selector won't work. And therefore none of the CSS inside that selector will be seen.

your options are:

  1. Rewrite your CSS so you only use features that are available in the browsers you want to support.

  2. Keep using those features, and stop supporting IE8.

  3. Use a polyfill script like Selectivizr to help IE8 understand those CSS selectors.

IE8 doesn't support those CSS selectors. But you're way over complicating things.

It'd be simpler using multiple selectors and you don't need to use the unsupported pseudo classes

UL.action{
  background: url("../images/buttons/btnShineBackground.png") top left repeat-x;
}
UL.action.btnImage{
  background: none:
}

IE8不支持Pseudo类: https//developer.mozilla.org/en-US/docs/Web/CSS/ :not

IE8 does not support CSS3 selectors (eg :not )

Reference: http://caniuse.com/#feat=css-sel3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM