簡體   English   中英

如何將CSS僅應用於IE 8及以下版本

[英]How do I apply css to only IE 8 and below

我希望我的某些樣式僅適用於IE 8及更低版本。 我也只想更改樣式表,而不是html。 這可能嗎?

這是我的樣式,我只想應用於IE 8及更低版本(我不想更改IE 9或10)

.ui-icon-searchfield:after {
        background-color: #000000;
        background-color: rgba(0,0,0, 0.4);
        background-image: url(images/icons-18-white.png);
        background-repeat: no-repeat;
        -webkit-border-radius: 9px;
        border-radius:  9px;
        filter: alpha(opacity=40); 

}

我只希望將最新樣式用於IE 8及更低版本

兩種選擇:

1:

.ui-icon-searchfield:after {
    background-color: #000000\9; /* IE8 and below */  
    background-color: rgba(0,0,0, 0.4)\9; /* IE8 and below */  
    background-image: url(images/icons-18-white.png)\9; /* IE8 and below */  
    background-repeat: no-repeat\9; /* IE8 and below */  
    -webkit-border-radius: 9px\9; /* IE8 and below */  
    border-radius:  9px\9; /* IE8 and below */  
    filter: alpha(opacity=40)\9; /* IE8 and below */  
}

2:

<!--[if IE 6]>
/*According to the conditional comment this is IE 6*/
  .ui-icon-searchfield:after {your stuff}
<![endif]-->
<!--[if IE 7]>
/*According to the conditional comment this is IE 7*/
  .ui-icon-searchfield:after {your stuff}
<![endif]-->
<!--[if IE 8]>
/*According to the conditional comment this is IE 8*/
  .ui-icon-searchfield:after {your stuff}
<![endif]-->

我的建議是第二個(視情況而定)

查看此鏈接。 它具有在IE CSS上工作所需的所有信息。

https://css-tricks.com/how-to-create-an-ie-only-stylesheet/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM