Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2012
    Posts
    84
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Pseudo class problem

    Is there any reason why this code isn't selecting my first <li> element? Note: the default font color is gray.

    Code:
    <div id="bottom-nav">
                	<ul>
                    	<li><a href="#" title="T-Shirts">T-Shirts</a></li>
                        <li><a href="#" title="Contact">Contact</a></li>
                        <li><a href="#" title="Sevices">Services</a></li>
                        <li><a href="#" title="About">About</a></li>
                        <li><a href="#" title="Work">Work</a></li>
                        <li><a href="#" title="Latest">Latest</a></li>
                    </ul>
                
     </div>
    Code:
    #bottom-nav ul li:first-child {
    	color: #000;
    }

  • #2
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Code:
    #bottom-nav ul li:first-child > a {color: #000;}

  • #3
    New Coder
    Join Date
    Apr 2012
    Posts
    84
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tempz View Post
    Code:
    #bottom-nav ul li:first-child > a {color: #000;}
    Genius! I see what I did, just need to go one more level. Thanks.

    It also worked by doing "li:first-child a".


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •