Solved

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

Posted on 2014-10-13
6
840 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 42

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 42

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 to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn how to dynamically set the form action using jQuery.

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now