我为我的链接设置了背景色以使其突出,问题是它也适用于以图像而不是文本为子项的链接。结果是图像底部有一个小背景。 (参见:http://blog.cmstutorials.org/reviews/general/featured-tutorial-of-the-week-05-feb-2011)
当它有一个 img 作为 child 时,我如何删除链接的背景?我认为这样的事情会起作用:
.featured_tutorial img < a
最佳答案
CSS 不支持 parent
选择器。
您必须使用像 a.this_link_contanis_img{/*override background*/}
这样的类
或者您可以为 img 设置一个新属性。这可以隐藏链接的背景。
.featured_tutorial img{/*覆盖背景*/}
编辑:好的,这对你的情况不起作用..
关于css - 当图像的父级从链接中删除背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4906472/