Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Sep 2011
    Posts
    307
    Thanks
    50
    Thanked 1 Time in 1 Post

    A:Hover background image not showing

    This site has a navigation menu who's elements I want to have a background image display on hover, or when the page is active.

    On line 1428 of style.css, I have:

    Code:
    .main-navigation li a:hover, .main-navigation li a:current, .main-navigation li a:active {
       background: url(images/menu_hover.jpg) repeat-x top;
    }
    This doesn't work.

    It does work if I apply the background image to a:link, so the image URL is correct.

    Why isn't it working for a:hover, a:current, a:active?
    Last edited by SRD75; 02-05-2013 at 05:27 AM.

  2. #2
    Regular Coder
    Join Date
    Dec 2010
    Posts
    443
    Thanks
    22
    Thanked 59 Times in 59 Posts
    Can you post a link for us to see ?
    Can't really help with only that,
    Although your use of a:current is not correct. It should be a.current, or a:active

    If you could post a URL that would help alot.


    SORRY
    didnt see the link
    Looking at it now

  3. #3
    Regular Coder
    Join Date
    Dec 2010
    Posts
    443
    Thanks
    22
    Thanked 59 Times in 59 Posts
    I believe it is because of the .main-navigation li a:current,

    Because when i add the same background code, into where you have defined the colour

    Code:
    .main-navigation li a:hover {
    It works just fine.
    Try this.

    Code:
    .main-navigation li a:hover, .main-navigation li.current-menu-item:hover a {
    		background: url(images/menu_hover.jpg) repeat-x top;
    	}
    That should do the trick
    What we are doing is calling class for the current LI for the current tabs, and keeping the hover the same

    Hope this helps.

  4. Users who have thanked aaronhockey_09 for this post:

    SRD75 (02-06-2013)

  5. #4
    Regular Coder
    Join Date
    Sep 2011
    Posts
    307
    Thanks
    50
    Thanked 1 Time in 1 Post
    Thanks Aaron!


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •