UL CSS 边框问题

发布于 2024-10-07 14:03:04 字数 142 浏览 0 评论 0原文

我正在拼命寻找一种方法来使其发挥作用。我有一个使用图像作为链接的菜单。但在 IE 和 FF 中,图像周围有一个恼人的边框,我不知道如何去掉。

你能快速告诉我 CSS 属性以避免这种影响吗?

预先感谢您的宝贵时间。

安东尼奥

I am desperately trying to find a way to get this working. I have a menu that use images for links. But in IE and FF there is an annoying border around the image that I don't know how to get rid of.

Would you be able to quickly tell me the CSS attribute to avoid this effect.

Thanks in advance for your time.

Antonio

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

青芜 2024-10-14 14:03:04
ul li img { border: 0 }
ul li img { border: 0 }
深府石板幽径 2024-10-14 14:03:04

我相信您正在谈论添加到 a 标记内的 img 元素的隐式 outlineborder

修复方法很简单:

a img
{
  border: 0 none;
  outline: 0 none;
}

outline 可能不再需要,我不确定是否还有浏览器使用 outline 来实现效果。

编辑添加:

由于 FF/IE 中的某些原因,imga 的特异性太低,无法覆盖默认行为。

I believe you are talking about the implicit outline or border that are added to img elements within a tags.

The fix is simple:

a img
{
  border: 0 none;
  outline: 0 none;
}

The outline may no longer be necessary, I'm not sure if any browsers use outline for the effect any more.

Edit to add:

For some reason in FF/IE, the specificity of img or a is too low to override the default behavior.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文