How to hide first li in ul?

263 views Asked by At

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>
2

There are 2 answers

0
Dryden Long On

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/

0
Pablo Rincon On

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