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 6 of 6

Thread: help html/css

  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help html/css

    i try make a blue color in the <li>Home</li>
    html
    <ul>
    <li><a href="#" class="blue1">Home</a></li>
    <li><a href="#">Service /</a></li>
    <li><a href="#">Protfolio /</a></li>
    <li><a href="#">Blog /</a></li>
    <li><a href="#">Contact /</a></li>
    </ul>


    css

    #header ul{
    float: left;
    }

    #header ul li{
    float: left;
    text-decoration: none;

    }


    #header ul li a {
    font-family: arial;
    font-size: 20px;
    color:#444444 ;
    text-decoration: none;

    }


    .blue1 {
    color:0b79a3;


    }

    #header ul blue1{
    color: 0b79a3 ;

    }

  • #2
    Regular Coder
    Join Date
    Jul 2012
    Location
    London
    Posts
    473
    Thanks
    4
    Thanked 86 Times in 86 Posts
    Quote Originally Posted by iceman123123 View Post
    i try make a blue color in the <li>Home</li>
    html
    <ul>
    <li><a href="#" class="blue1">Home</a></li>
    <li><a href="#">Service /</a></li>
    <li><a href="#">Protfolio /</a></li>
    <li><a href="#">Blog /</a></li>
    <li><a href="#">Contact /</a></li>
    </ul>

    .....continues!..
    New code.
    Code:
    <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Service /</a></li>
    <li><a href="#">Protfolio /</a></li>
    <li><a href="#">Blog /</a></li>
    <li><a href="#">Contact /</a></li>
    </ul>
    
    
    css
    
    #header ul li a:first-child {color:#0b79a3;} /* Target is "a" tag */
    #header ul li:first-child {color:#0b79a3;} /* Target is "li" tag */
    Last edited by tempz; 01-06-2013 at 11:14 PM. Reason: Hash on css

  • #3
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Code:
    color: #0b79a3;
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS

  • #4
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i put # in my editor in here i delete this By mistake.

    still dont working.

  • #5
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    #header ul .blue1 {color:#0b79a3;} works................

  • #6
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Yes, you needed a dot for the class.

    Code:
    #header ul li a {
    font-family: arial;
    font-size: 20px;
    color:#444444 ;
    text-decoration: none;
    
    }
    
    
    .blue1 {
    color:#0b79a3;
    
    }
    This combination doesn't work because both refer to the same elements (assuming your list is contained within #header), and the first section has higher specificity - it is a more specific selector than the second one.
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Posting Permissions

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