我有一个看似简单的HTML结构:Simple xxx yyy {} CSS选择器不工作 - 为什么?
<div class="featured-image img-wrapper full-width">
<a href="http://localhost/wordpress/?p=26">
<img ... />
</a>
</div>
现在我要定位的一个(不幸的是没有自己的类),所以我用这个CSS
.img-wrapper a {
background-image:url(../images/bkgs/stripes_tiny_08.png);
background-repeat:repeat;
}
但没有任何反应对这个元素!这当然不是背景图片本身,也尝试过简单的颜色。奇怪的是:在页面上还有另外一个类似的构造,在那里选择器工作! 萤火虫显示以下CSS路径(目标是一个在末端)
working: html.js body.single div#page.wrap div#main-container.container div#primary.site-content div#content article#post-26.post-26 div.featured-image a.img-link
not wrk: html.js body.single div#page.wrap div#main-container.container div#primary.site-content div#content aside#yarpp_widget-2.widget div.bloglist article.post div.three div.featured-image a
我的想法。没有找到任何压倒一切的CSS声明。任何想法我可以如何瞄准?
编辑:目标a包含一个img,它具有:悬停不透明度设置。这样,我可以看到背景色的作品,而不是背景图像。然而
http://jsfiddle.net/r48ST/它的工作原理。我假设你的形象不透明,你不能看到它的背后,或者说有更多的冲突风格。 – MetalFrog 2012-07-31 14:22:07
它不是.img-wrapper一个img {/ * ... * /}? – 2012-07-31 14:22:13
只是意见:添加显示:块; to .img-wrapper a – 2012-07-31 14:23:01