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 Basics (2014) Understanding Values and Units Pixels and Percentages

Angela Williams
Angela Williams
5,805 Points

What is the correct code for task 1 Challenge Pixels and Percentage? My answer : span .title { font-size: 26px: }

My answer is span .title {font-size: 26px;}

2 Answers

Tony Nguyen
Tony Nguyen
24,934 Points

In the html, you are trying to select

<span class="title"></span>

You should be selecting a span with the class title, so no space is needed.

span.title {
  font-size: 26px;
}
Austin Whipple
Austin Whipple
29,725 Points

And to expand on this, without a space (as in Tony's example), you'll select any <span> element with the class of "title" assigned. In your original code with a space in between, you're selecting any element with the class of "title" that is a descendant of a span. For instance, your original selector would style this:

<span>
<a class="title" href="#">Link!</a>
</span>

Check out more combinators at W3Schools.

Angela Williams
Angela Williams
5,805 Points

Thanks a lot Tony and Austin