How to apply different CSS style to child elements as they occur inside one another?

Posted by Starx on Stack Overflow See other posts from Stack Overflow or by Starx
Published on 2010-05-27T07:21:34Z Indexed on 2010/05/27 7:31 UTC
Read the original article Hit count: 208

Filed under:
|

For example my HTML is this

<ul>
    <li>Sample 1</li>
    <li>Sample 2
        <ul>
            <li>Sub 1</li>
            <li>Sub 2</li>
            <li>Sub 3
                <ul>
                    <li>Grandsub 1</li>
                    <li>Grandsub 2</li>
                    <li>Grandsub 3
                        <ul>
                            <li>verySub 1</li>
                            <li>verySub 2</li>
                        </ul>
                    </li>
                </ul>
            </li>
        </ul>
    </li>
    <li>Sample 3</li>
</ul>

I want to use different styles on every child <UL> without defining any class or id on them.

I dont know how many child <ul> might occur inside one another so inline css will not to the job

Is this possible?

© Stack Overflow or respective owner

Related posts about css

Related posts about website-designing