2015-07-20 53 views
0

enter image description here如何刪除下劃線時懸停在IE中的圖像?

我正在使用數據表,表中的每一行都有一列圖標。我注意到,在Chrome和Firefox中,當我將鼠標懸停在圖標上時,它會改變顏色(這很好)。但是,在IE中,當用戶將鼠標懸停在圖標上時,圖標帶下劃線,直到用戶移動光標。我曾嘗試過:

tr td a i:hover{ 

text-decoration: none !important; 
} 

但這並不適用於我。我還將這些圖標包裝在display-inline中,但它仍不起作用。 請幫助

+3

我假設圖像包裹在錨標籤中?你用過「文字裝飾:沒有!重要」;在錨而不是圖像?你能告訴我們你的html/css嗎? –

+0

你可能也有一個懸停邊框的東西,刪除邊框; 0; – Medda86

+0

你能幫助我們創建一個小提琴嗎? https://開頭的jsfiddle。net/ – nextstep

回答

1

指定錨標記類:

<a class='NoUnderline'>blah blah</a> 

然後起飛錨標記級別的文本的裝飾。 CSS:

a.NoUnderline 
{ 
    text-decoration:none; 
} 
0

嘗試設置:hover選擇包括text-decoration: none;

例如:

yourelement:hover{ 
    text-decoration: none; 
} 
+0

我試過了,它沒有工作 – Muraad

+0

歡迎來到堆棧溢出isaac。我正在審覈您的答案,並希望提供一些關於如何改進的提示。首先,當你寫一個答案時,讓你向OP解釋它是如何回答他們的問題的。其次,儘可能嘗試鏈接官方文檔來證明你的概念。最後,請閱讀以下文章:http://stackoverflow.com/help/how-to-answer –

1

你必須給border:none圖像標籤

CSS

img{ 
border:none; 
} 
tr td a:hover{ 

    text-decoration: none !important; 
} 
0

我們真的不知道你的環境是什麼樣的,沒有代碼。

但你可以試試。

.element:hover {text-decoration: none; border: 0px} 

img:hover {text-decoration: none; border: 0px} 

如果它不能正常工作;嘗試使用!important或文檔的<head></head>添加它。 (但是如果你編碼正確,你不應該做這種練習)

0

問題是圖像本身沒有下劃線,但圍繞圖像的錨標記確實。

要從錨刪除所有下劃線,你必須這樣做:

tr td a:hover{ 
    text-decoration: none !important; 
} 

但是,如果你不想從一個表格單元格中所有錨刪除下劃線,你需要一個specifiy類別:

tr td a.nounderline:hover{ 
    text-decoration: none !important; 
} 

並將anchors class屬性設置爲nounderline。