sjith
sjith

Reputation: 445

restrict the style to first level elements

I am using following style and html code for listing some items

li.DC a > ins.jstree-icon{
height:22px; width:350px; border:#999999 1px solid; margin-bottom:2px; list-style:none; background-color:red;

}

<li class="DC">
    <a><ins class="jstree-icon"></ins>HelloName</a>
    <ul>
        <li>
            <a><ins class="jstree-icon"></ins>HelloName</a>
        </li>
    </ul>
</li>

I want to apply the style to first level occurrence of jstree-icon, right now the style is getting applied to the 2nd level also. Can any one suggest the CSS for the same ?

Upvotes: 0

Views: 84

Answers (1)

Sowmya
Sowmya

Reputation: 26979

You need to change the selector place

Your selector is saying first class name of the a tag (which is not valid) but what you need is first a tag of the li.

li.DC > a ins.jstree-icon{
    height:22px; width:350px; border:#999999 1px solid; margin-bottom:2px; list-style:none; background-color:red;}

DEMO

Upvotes: 1

Related Questions