user4055428
user4055428

Reputation: 1167

What is the CSS selector for what I'm trying to do?

I have two different "layers" (What's the correct terminology???) of uls and I want to select the a tags which are only within first one.

<div>
   <ul> 
       <li>
           <a>Here's what I'm trying to apply a certain style to</a>
           <ul>
                <li>
                     <a>Here's what I'm not trying to apply that certain style to</a>
                </li>

            </ul>

       </li>

   </ul>
</div>

So I know I can't just do div ul li a because that would include the inner a tags.

Upvotes: 0

Views: 57

Answers (1)

Quentin
Quentin

Reputation: 943142

You need to:

  • Use child combinators
  • Reference the div element

Such:

div > ul > li > a

Upvotes: 3

Related Questions