Solved

pure css down arrow hover - works but li:hover issue

Posted on 2014-10-13
6
894 Views
Last Modified: 2014-10-14
When hovering over the links in the following example, down arrows appear. This is exactly what I want.

The problem is that if I hover over the area where the down arrows appear, without hovering over the link itself, the down arrows still appear.

FYI - the reason I'm using li:hover to display the down arrow image is because I'm using a background color in the a:hover - if I call the arrow in a:hover, it gets lost in the background image.

Hover Example

css:

<style type="text/css">
#nav {
    margin-top:0;
padding: 12px 0;
margin-left: 0;
background-color: #fafafa;
color: #464646;

}

#nav li {
    list-style: none;
    display: inline;
    margin: 0px;
    padding: 0;
    padding: 22px;
    padding-right: 0;
    padding-left: 0;
}

#nav li a {
    font-family: Arial;
    font-style:normal;
    text-transform: uppercase;
    text-decoration: none;
    color: #464646;
   padding: .7em 3em;

    border-right: 1px dashed #959595;
}

#nav li a:hover {
    background-color: #94b7bb;
color: #005596;
font-weight: bold;
}

#nav li:hover {
    background: transparent url(http://www.medicalwebdevelopers.com/underscore/wp-content/themes/kythera/images/nav-arrow.png) no-repeat scroll center bottom;
    margin: 0;
}


#active a:link, #active a:visited,#active a:hover
{
/* border: 1px solid #333; */
background-color: #fafafa;
color: #005596; 
font-weight:bold;
}



</style>

Open in new window


html:

<ul id="nav">
<li id="active"><a href="home.php">Home</a></li>
<li><a href="photos.php">Photos</a></li>
<li><a href="videos.php">Videos</a></li>

<li><a href="add.php">Add a Restaurant</a></li>
<li><a href="delete.php">Delete a Restaurant</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>

Open in new window

0
Comment
Question by:phillystyle123
  • 3
  • 3
6 Comments
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 40378694
Your arrow image is behind some HTTP authentication so the link to your example doesn't work.

Having said that, not sure what you're trying to say. The Hover CSS that adds the arrow is on the LI, so hovering anywhere over the LI will show the arrow - whether you hover over the link or not is irrelevant.
0
 

Author Comment

by:phillystyle123
ID: 40378797
Please try the link again:

http://medicalwebdevelopers.com/navtest.html

You'll see what the issue is. Hovering over the area where the arrows appear, only the arrow appears. The background color behind the link text is being triggered by a:hover. the arrow is being triggered by li:hover.
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 40378805
OK. Got ya. On line 36 of your stylesheet, change this:

#nav li a:hover { }

to this:

#nav li:hover a { }
0
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 

Author Comment

by:phillystyle123
ID: 40378825
oh my -that worked! thanks for the help
0
 
LVL 43

Expert Comment

by:Chris Stanyon
ID: 40378832
No worries - glad it worked :)
0
 

Author Closing Comment

by:phillystyle123
ID: 40380424
Thanks again for the help
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question