Rohit Mehra
Rohit Mehra

Reputation: 229

How to hide first li in ul?

I want to hide first li in a drop down in ul which has the ID "#ctl00_blInfo".

Below is css that I am using :

ul#ctl00_blInfo li:first-child { display : none }

Which is working fine except that I am getting an issue in ie7 where entire ul is hiding and it's not letting the drop down open.

<ul>
    <li>a</li>
    <li>b</li>
    <li><!--Drop down section-->
        <ul id="ctl00_blInfo">
            <li>aa</li>
            <li>bb</li>
            <li>cc</li>
        </ul>
    </li>
</ul>

Upvotes: 0

Views: 251

Answers (2)

Pablo Rincon
Pablo Rincon

Reputation: 1039

Yes, actual comments are taken as 'first child' in oder versions of IE. Either remove the comment or move it somewhere else.

Upvotes: 0

Dryden Long
Dryden Long

Reputation: 10182

Your issue seems to be with the comment you have. For some reason IE7 bugs out and interprets the comment as an actual element. Try removing the comment and it should work as expected.

http://robertnyman.com/2009/02/04/how-to-solve-first-child-css-bug-in-ie-7/

Upvotes: 1

Related Questions