Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Luke Ayres
6,170 Pointsnth-child not working after first
Hey all, I have a small problem where I am trying to move a collection of images across a background (they are all the same image but I want to target them individually so I have pasted multiple links as can be seen below, if there's a better way around this feel free to explain) the problem is I can target the first img in CSS with either first-child or nth-child but the following children seem unmoved by the exact same CSS
The three img are all children of .background as far as I'm aware?
<div class="container clearfix">
<div class="background">
<img src=../GraphicArt/InkScape/g4109.png alt="1">
<img src=../GraphicArt/InkScape/g4109.png alt="2">
<img src=../GraphicArt/InkScape/g4109.png alt="3">
</div>
<div class="head"></div>
<div class="Rhead"></div>
I can target the first child but the others are not even targeted
div.background img:nth-child(1) {
left:540px;
top:160px;
position:relative;
};
div.background img:nth-child(2) {
left:200px;
top:156px;
position:relative;
};
Here is the CSS for .background
.background {
height:600px;
width:1000px;
background: salmon url('../../GraphicArt/Inkscape/g4106.png' ) ;
background-repeat: no-repeat;
position:relative;
}
Thanks in advance :)
2 Answers

Salmen Bejaoui
8,017 Pointsyou have two semicolons after the curly brackets

Luke Ayres
6,170 PointsThank you very much Salmen, it's these painfully obvious mistakes that seem to be making the most trouble for me!