Solved

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

Posted on 2014-10-13
6
880 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Outlook opens HTML email as text 4 24
"Pause" execution of javascript function for x miliseconds 2 29
Select case on click 3 16
key press alert 2 19
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

831 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