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.

CSS CSS Foundations Selectors Using Combinators in Selectors

Combinator question

wow, i can't believe i'm stuck here. The question is: "Create a child selector to target the anchor element that is a direct child of the div. Set its color to green and font weight to bold." It's not happening for me.

.div > a {
     color: green;
     font-weight: bold;
<!DOCTYPE html>
    <title>More Selectors</title>
    <link rel="stylesheet" href="css2-main-style.css" type="text/css" media="screen">
    <link rel="stylesheet" href="style.css" type="text/css" media="screen">
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc pulvinar consequat tortor, nec venenatis erat elementum scelerisque. Curabitur sit amet risus nisi. Aenean aliquet euismod augue at viverra. Ut varius arcu in.</p>
        <a href="#">Lorem iaculis ullamco.</a>
        <h2>Donec tempor sodales</h2>
        <p>Sed tincidunt rutrum enim, vitae pharetra justo suscipit a. Nam eu egestas risus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam tempor, augue quis.</p>
        <a href="#">Donec eget lorem id nisi.</a>
        <p>Sed sit amet nulla elit, vel lacinia nisi. Donec eget lorem id nisi vehicula auctor id et dui. Etiam aliquet aliquet sem in rutrum. Cras posuere pharetra <a href="#">sem vitae egestas</a>.</p>

nevermind, I got it, I needed to remove the period on div

3 Answers

Hi Misty,

Wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help with syntax highlighting. The backtick lives on the key with the tilde.

        <p>This is code!</p>
Misty Majewski
Misty Majewski
5,276 Points

Hey, how did you get a screen shot of your work? I read the markdown cheatsheet but cannot figure out how it really works.

Misty Majewski
Misty Majewski
5,276 Points

Thanks, I was using the wrong marks..