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 Foundations Selectors Using Combinators in Selectors

how do i select the main div to create a child combinator?

how do i select the main div so i can add the child combinator?

index.html
<!DOCTYPE html>
<html>
<head>
    <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">
</head>
<body>
    <h1>Combinators</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.</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>
    </div>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */
div < a {
  color: green;
  font-weight: bold;
}

4 Answers

You were close, you just don't need the less than symbol.

div a {
  color: green;
  font-weight: bold;
}

but it is a child combinator so it would bee the '>' right?

Using the '>' would signify any anchor immediately inside of the div.

Without it you are saying any anchor anywhere inside of the div.

Check out this article if you're curious: http://www.w3schools.com/css/css_combinators.asp

I'm not sure if using the '>' will pass the challenge, but I know that the code I gave you above will.

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

Hi, Michael. For this challenge, you are very close. The child combinator you need is > instead of <.

haha darn it. Thank you for your assistance Ryan :D