css - 从链接图像中删除 css

标签 css

我们的设计师为链接创建了这个 CSS

A
{
   text-decoration: underline;
    color: #E77C15;
}

A:link
{
    text-decoration: underline;
    color: #E77C15;
}

A:visited
{
    text-decoration: underline;
    color: #E77C15;
}

A:hover
{
    text-decoration: underline;
    color: #039;
}

A:active
{
    text-decoration: underline;
    color: #E77C15;
}

我需要一个没有边框的图片链接。现在它的边框颜色来自它周围的 css。

我试过了

   <a href='myurl' style="border-style:none; text-decoration:none" >
         <img src="myimage.png" style="width: 20px; height: 20px" alt="Remove" title="Remove" />
   </a>

但边框仍然显示。 如何删除此链接图像周围的边框。 谢谢!

最佳答案

您应该将 CSS 添加到 <img> ,而不是<a> .

最好使用通用的 CSS 规则:

img { border:none }

关于css - 从链接图像中删除 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6203477/

相关文章:

html - 同一行中的两个 div,其中一个 div 中的文本根据第二个 div 的宽度被剪裁

css - 圆形 Material Icons 边框和颜色问题

css - 移动样式表

html - Bootstrap 3 header 在 Firefox 上看起来不正确

html - 如何将完整图像完美地放入 slider ?

jquery - 我的 jQuery 不使用 .css() 函数更改字体颜色

css - 是否有必要为网络字体提供后备字体?

javascript - 如何将 CSS 类的索引与 JavaScript 匹配?

html - 在 Center 上调整对象,仅当我确定宽度时才有效

html - css 需要在没有字体 css 的情况下工作