Solved

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

Posted on 2014-10-13
6
995 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

 

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

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
The viewer will learn how to dynamically set the form action using jQuery.

627 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