2

Just like it says, the color property is not changing the color of the text.

The HTML:

<body>
  <header>
    <ul id="navbar">
      <li><a href="/home.html">Home</a></li>
      <li><a href="/money.html">Money</a></li>
      <li><a href="/sports.html">Sports</a></li>
    </ul>
  </header>
</body>

and the CSS:

#navbar {
    list-style-type: none;
}

#navbar li {
    background-image: url(../images/bg-nav.c.gif);
    background-position: left top;
    color: white;
    float: left;
    font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
    height: 37px;
    text-align: center;
    text-decoration: none;
    width: 120px;
}

4 Answers 4

5

You have apply color to your <a> tag. Find the below change

#navbar li a{
   color:#fff;
}
Sign up to request clarification or add additional context in comments.

4 Comments

I did the exact same thing this morning
you don't need to add li you can just use #navbar a
Of course you do that unless you don't use any '<a>' in your nav which will affect the all.
since it is not correct to use <a> als <ul> child you no not need to add LI
0

You need to target the anchor (a) elements inside the li's.

Try #navbar li a

Comments

0

You have to change

a:link {  }
a:visited {  }
a:hover { }
a:active {  }

possibly with referenz to your navbar if you use multiple links on your site

Comments

0

LIVE DEMO

enter image description here

#navbar {
    font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, sans-serif;
}

#navbar li {
    float: left;
    list-style-type: none; /*apply list-style to li*/
    text-align: center;/*here we are telling LI to `text-center` all child anchor */
}
#navbar a {
    background-image: url(https://d3ui957tjb5bqd.cloudfront.net/uploads/2013/05/firelight-logo-preview-1-f-560x372.png);
    background-position: left top;
    background-size:100% auto;
    background-repeat:no-repeat;
    color: white;
    text-decoration: none;
    padding: 20px 60px; /* use padding instead of width and height since you don't know how long the text will be */
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.