Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
bartholomew bicklebaum
4,606 PointsCSS Selectors Quiz
I am having trouble with this question:
Add a CSS selector to make the span tag inside the paragraph be underlined.
My answer is:
span p {
text-decoration:underline;
}
Still incorrect...can someone please help?
8 Answers
James Barnett
39,199 Points@Robert -
The difference between p > span { text-decoration: underline; } and p span { text-decoration:underline; } is that the combinator of > means "directly inside of the parent" whereas the space combinator means "nested somewhere inside of the parent".
The reason that p > span { text-decoration: underline; } is a better choice is because it selects just the element the instructions asked for.
Whereas p span { text-decoration:underline; } could accidental select other elements besides that first p element.
Micah Ianniello
Courses Plus Student 3,618 PointsI'd try
p>span {text-decoration: underline;}
Rodrigo Muñoz
Courses Plus Student 20,171 PointsI guess it's:
p span { text-decoration:underline; }
bartholomew bicklebaum
4,606 PointsThanks guys! It worked.
ecp
838 Points@James = the info slinging MASTER!
Thanks for providing this explanation. I'm going to borrow it to inform future members who encounter similar problems :)
Will Lam
7,027 PointsHey all,
Looks like I'm encountering the same problem.
I've tried different approaches but this is what I have, but yet I still get this error "Oops! It looks like Task 3 is no longer passing."
* {
background-color: #FFF;
}
h2 {
color: blue;
}
p > span {
background-color: #000;
color: #FFF;
text-decoration: underline;
}
Will Lam
7,027 PointsHey guys.. any help on this?
Thanks!
James Barnett
39,199 PointsGenerally speaking ... if you are posting your own code, then you should create your own thread.