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

Code Challenge: More Selectors

Question: Use a Child Selector to select the anchor element that is a direct child of the div. Set its color to green and the font weight to bold.

Code Presented:

<body>
    <h1>Lorem ipsum dolor sit</h1>
    <div>
        <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 <a href="#" title="foo">lorem iaculis ullamcorper</a>.</p>
        <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 vehicula...</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 sem vitae egestas.</p>
    </div>
</body>

** The body 'div' 'a' etc selectors aren't showing up when i post, to fix this for the future please let me know how to fix

My answer:

div > a {
 color: green;
 font: bold;
}

Response I keep getting: Bummer! The child selector is >, try double checking your css selectors.

I've looked at the video presented and also a book I bought and it looks like Im writing the code properly, not sure if this is an error on the website or if I'm actually writing the code wrong. Please help!

thanks

3 Answers

Try font-weight: bold instead of just font.

Also 4 spaces will allow the code to show like so:

<div>This is my text with <a>an anchor</a></div>

If you hit the space bar 4 times on a new line, you can than add code markup and it will display to the forum. You know how you said the div and anchor selectors were not showing up? That's why. If you would have indented that block of code by 4 spaces, it would have.

Between the reply box and the reply button is a line of text with an anchor that says "Markdown Cheatsheet". If you click on it, it'll show you everything you can post to the forum, and the format to do so.

That worked, thanks.

Not sure what you meant here:

Also 4 spaces will allow the code to show like so:

<div>This is my text with <a>an anchor</a></div>