2015-09-03 144 views
0

HI我有一個小問題,懸停CSS代碼。在IE8上,當我將鼠標移動到文本上但是外部文本不起作用時,我的鏈接懸停。我不知道我的錯誤在哪裏。需要一些幫助!:懸停在IE8上不能正常工作

HTML: -

<a href="#" class="ctaBlock" name="">text text text</a> 

CSS: -

.ctaBlock { 
    border: 1px solid #333; 
    font: 400 10px/43px arial,helvetica,sans-serif; 
    color: #333; 
    letter-spacing: .1em; 
    display: inline-block; 
    text-align: center; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap; 
    text-transform: uppercase; 
    line-height: 42px; 
    width: 34%; 
} 
#content .ctaBlock:after { 
font-size: 7px; 
font-weight: 400; 
line-height: 1; 
font-family: iconFont; 
font-smoothing: antialiased; 
-webkit-font-smoothing: antialiased; 
-moz-osx-font-smoothing: greyscale; 
font-style: normal; 
font-variant: normal; 
letter-spacing: normal; 
text-decoration: none; 
text-transform: none; 
content: '>'; 
display: inline; 
margin-left: 3px; 
} 
#content .ctaBlock:hover { 
background:rgb(255,255,255); 
background: transparent\9; 
background:rgba(255,255,255,0.3); 
filter:progid:DXImageTransform. 
Microsoft.gradient(startColorstr=#4cffffff,endColorstr=#4cffffff); 
zoom: 1; 
text-decoration: none; 
cursor: pointer; 
} 

回答

1

IE8在處理元素的透明部分時遇到了一些問題。我前一陣子有同樣的問題,我在CSS中加入透明圖像(由1px的1px的)作爲背景來解決它:

background-image: url("transparent.png"); 

或用一個數據URL:

background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3wgUEhgsb9YM9wAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAADUlEQVQI12NgYGBgAAAABQABXvMqOgAAAABJRU5ErkJggg==); 

我認爲更簡單的解決方案可能會爲鏈接添加不透明的背景色。但這取決於您對透明背景的需求。我沒有測試過第二種解決方案,但你可以試試看。

+0

感謝它處理數據網址 – User1979

0

透明度屬性不會在IE8工作。添加這個背景:rgb(255,255,255);然後在最後添加不透明度:0.8。或者如果你使用哈希顏色代碼會更好。