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

CSS

CSS 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

@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.

I'd try

p>span {text-decoration: underline;}

I guess it's:

p span { text-decoration:underline; }

Thanks guys! It worked.

@James = the info slinging MASTER!

Thanks for providing this explanation. I'm going to borrow it to inform future members who encounter similar problems :)

Hey 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;
}

Hey guys.. any help on this?

Thanks!

Generally speaking ... if you are posting your own code, then you should create your own thread.