2016-12-05 113 views
1

我有一個頁面,當圖像被點擊時,圖像周圍會顯示一個邊框,圖像同時也是一個鏈接,爲什麼會發生這種情況?它只是在點擊圖像時發生。 這是我的代碼:當圖像鏈接被點擊時邊框顯示

<div id="hammer"> 
     <a asp-action="myaction" asp-controller="mycontroller" class="col-xs-6"> <img src="~/images/online_keyboard_news.jpg" class="highlight" width="100%" height="auto" /> firstimage</a> 
     <a asp-action="myaction2" asp-controller="mycontroller2" class="col-xs-6"> <img src="~/images/document-428336_960_720.jpg" class="highlight" width="100%" height="auto" /> secondimage</a> 
     </div> 
     <br /> 

,這是我使用的CSS類:

#hammer { 
     font-size: 18pt;  
     margin: 15px 0 0 0; 
     text-align: center; 
    } 

這是正在發生的事情的圖像被點擊就在: enter image description here

+1

你使用什麼瀏覽器?因爲有時它取決於瀏覽器。在其他瀏覽器中嘗試它 –

+0

@ ooo-Ghost-ooo你是對的,這只是發生在Internet Explorer中,我已經嘗試過使用Google Chrome並且不顯示邊框,對於如何在Internet Explorer中避免它的任何想法,我的Internet Explorer版本是11 – AlexGH

+0

對不起。我不知道如何解決這個問題,我剛剛在學校練習時碰到過它。 –

回答

3

outline:none;所有aimg元素

#hammer a, #hammer a img{ 
    outline:none !important; 
} 
1

添加這對你的css

#hammer > a { 
    outline: 0; 
} 
3

你可以嘗試設置outline css property爲none:

#hammer a, #hammer img { 
    outline: none; 
} 

讓我現在如果這可以幫助你。