Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-10-13
6
Medium Priority
?
1,036 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 44

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 44

Accepted Solution

by:
Chris Stanyon earned 2000 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 

Author Comment

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

722 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