Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion CSS Foundations Values and Units Color Values

Andrew Hoskins
Andrew Hoskins
4,888 Points

<l>i and <a> hover issues

I would like to have both my <li> and the embedded <a> both change at the same time when any portion of the <li> area is hovered upon. Currently, I get only get both if I hover over the <a> link and not when I am just hovering over the <li> area. Each time I add the <a:hover> to the CSS, it treats the link as its own separate CSS section, independent of the <li:hover>

          <ul>
            <li><a href="atty-index.html">Home</a></li>
            <li><a href="company.html">Our Company</a></li>
            <li><a href="services.html">Our Services</a></li>
            <li><a href="employment.html">Employment</a></li>
          </ul>
        </nav>```

and here is what I have for the corresponding CSS:

nav {
    clear: both;
    background-image: url("../images/metal.jpg");
    width: 100%;
    box-shadow: 0px 4px 3px;
    margin-bottom: 20px;
    border-top: 2px solid darkgray;
    display: block;
}

nav li {
    display: inline-block;
    width: 9em;
    text-align: center;
    margin: -1em 1% 1em -1%;
    border: 2px groove;
}

nav a {
    color: #4f0919;
    font-family: Noto, serif;
    font-weight: bold;
    font-size: 1.1em;
    line-height: 1.5em;
}

nav li:hover  {
    background-image: url("../images/gray.jpg");
    border: 2px inset gray;
    border-top:  2px inset white;
    border-left: none;
}