0

I want to apply style for first ul tag.Here i applied a css for first ul tag

.profile >ul:first-child {
  display: none;
}

But,Its not working here

<div class="profile">
    <h3>Account information</h3>

    <ul>
        <li>item1</li>
        <li>item2</li>
        <li>item3</li>
    </ul>  
    <h3>Recent infomation</h3>

    <ul>
        <li>item11</li>
        <li>item21</li>
        <li>item31</li>
    </ul>  
</div>
Jeremy W
  • 1,889
  • 6
  • 29
  • 37
Dhivya
  • 341
  • 1
  • 3
  • 10
  • why not give class name to your first "ul"? – Codeek Nov 27 '14 at 13:37
  • You should use ```first-of-type``` instead of ```first-child``` as the first child of ```div.profile``` is the ```h3``` element not the ```ul```, see http://stackoverflow.com/questions/3326480/last-child-style-working-first-child-style-not-working-why – mTorres Nov 27 '14 at 13:42
  • You are right mTorres.I am getting ans after applying .profile ul:first-type-of{ display:none;} – Dhivya Nov 27 '14 at 14:39

0 Answers0