防止外部链接指示图形显示在图像上
我在 CSS 中添加了以下内容:
#content a[target^="_blank"] {
background-image:url(images/extlink.png);
background-repeat: no-repeat;
background-position: right;
padding-right: 12px;
}
这为在新窗口中打开的所有链接提供了一个小的外部链接指示器(在维基百科上可见)。问题是它也对链接的图像执行此操作。显然,我不想在图像上显示该图形。有人知道如何解决这个问题吗?
编辑 有没有办法用 jQuery 做到这一点?
I've added the following bit to my CSS:
#content a[target^="_blank"] {
background-image:url(images/extlink.png);
background-repeat: no-repeat;
background-position: right;
padding-right: 12px;
}
This gives a little external link indicator (seen on Wikipedia) on all of the links that open in a new window. The issue is it also does this for linked images. Obviously, I don't want to have that graphic on images. Anyone have an idea on how to get around this?
Edit
Is there a way to do this with jQuery?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果将这些样式移至名为 external 的 CSS 类,则此 jQuery 代码应该可以工作(未经测试):
If you move those styles to a CSS class called external, this jQuery code should work (untested):