的HTML看起来像这样:CSS相邻选择问题
<div id="content_wide">
<div class="photo-center borderless"><img src="http://example.com/travel-path-map.png" alt="" title="" /></div>
...但由于某种原因,我似乎无法针对图片中心DIV这样的:
#content_wide + .photo-center { margin-top:10px }
有趣足够,一个更普遍的儿童选择器的作品:
#content_wide > .photo-center { margin-top:10px }
想法?
啊!是。大脑今天有点慢。只有当它是content_wide的第一个后代/孩子时,才有任何方法来定位照片中心? – Craig
'#content_wide .photo-center:first-child' should should target'.photo-center' if if it's first child –
完美。谢谢你,詹姆斯 – Craig