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; 
} 

让我现在如果这可以帮助你。

相关问题