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

Help with code challenge

I cant figure out what they want. How do I select the span element

Create a new rule that targets the span element inside .intro. Give the span element a bold font weight and an italic font style.

.intro { font-size: 1.25em; line-height: 1.6; }

1 Answer

Steven Parker
Steven Parker
243,644 Points

There is a couple of ways to do this.

You forgot to provide a link to the challenge, but it sounds like this can be done with either a child selector or a descendant selector. There may even be other possible choices, depending on the HTML.

If the element with the intro class is the direct parent of the span, you can use the child selector:

.intro > span { font-weight: bold; font-style: italic; }

If the span is nested deeper, you can use the descendant selector:

.intro span { font-weight: bold; font-style: italic; }

These are concepts that you will use quite frequently working with CSS, and there was probably a discussion on selectors just prior to this challenge. You might want to re-watch it.