2014-10-20 61 views
1

我想只選擇第一個圖像上移:僞選擇第n個孩子的問題

#rockfon_mono:nth-child(1) img { 
 
\t margin-top:-40px; 
 
    border: solid green; 
 
\t 
 
}
<div id="rockfon_mono"> 
 
<img src="images/products/rockfon-mono/rockfon-header.png" alt="" /> 
 
<h2>Mono® Acoustic TE</h2> 
 

 
<p>Seamless acoustic ceiling and wall lining |  Acoustic and aesthetic comfort | No more compromises</p> 
 
<p>The current trend in architectural design favours the use of highly reflective, sturdy materials such</p> 
 
<div id="rockfonImageOne">  
 
    <img src="images/products/rockfon-mono/Mono.png" alt="" /> 
 
</div> 
 
<h2>Acoustics</h2> 
 

 
<p>Full acoustic control for any space | Acoustic enhancement for new and refurbished spaces | High sound absorption | Improved speech intelligibility</p> 
 
<p>Acoustic and aesthetic comfort Mono Acoustic TE’s aesthetic quality matches its acoustic quality. Mono Acoustic TE provides high sound absorption, echo reduction, a significant decrease in reverberation</p> 
 
<div id="rockfonImageOne">  
 
    <img src="images/products/rockfon-mono/Acoustics.png" alt="" /> 
 
</div> 
 
<h2>Characteristics</h2> 
 

 
<p>System description and performance the unique Mono Acoustic TE system is a highly acoustic monolithic ceiling and wall lining. This patented innovation is made of high quality stone wool for optimum</p>

然而在整個頁面

+0

您將目標定位到ID本身(並且比它內部的每個img)將僞指派給img。 – 2014-10-20 13:05:58

回答

1

選擇每個圖像在您的特定HTML標記中,您可以使用直接子對象作爲其他imgs不是直接子對象

#rockfon_mono > img { 
    margin-top:-40px; 
    border: solid green; 
} 

DEMO

+0

非常感謝! – ADRIAN 2014-10-20 13:19:38