Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3784434
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:22:36+00:00 2026-05-19T11:22:36+00:00

I have an image that is a link. I want to show a different

  • 0

I have an image that is a link. I want to show a different image when the user hovers over the link.

Currently I’m using this code:

<a href="http://twitter.com/me" title="Twitter link">
<div id="twitterbird" class="sidebar-poster"></div></a>

div.sidebar-poster {
margin-bottom: 10px;
background-position: center top;
background-repeat: no-repeat;
width: 160px;
}
#twitterbird {
background-image: url('twitterbird.png');
}
#twitterbird:hover {
background-image: url('twitterbird_hover.png');
}

But I’m having loads of problems: the div isn’t picking up the CSS rules (the element just isn’t showing the related CSS rules when I view it in Firebug).

Perhaps this is because (as I know) this is invalid HTML: you can’t put an <a> around a <div>. However, if I switch to <span> then it seems I get bigger problems, because you can’t set a height and width on a span reliably.

Help! How can I do this better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T11:22:37+00:00Added an answer on May 19, 2026 at 11:22 am
     <a href="http://twitter.com/me" class="twitterbird" title="Twitter link"></a>
    

    use a class for the link itself and forget the div

    .twitterbird {
     margin-bottom: 10px;
     width: 160px;
     height:160px;
     display:block;
     background:transparent url('twitterbird.png') center top no-repeat;
    }
    
    .twitterbird:hover {
       background-image: url('twitterbird_hover.png');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a logo link that's using a background-image (css sprite). All works fine,
I have a background image that I want to show after the top header.
I have set up my page so that when the user hovers over an
i have this code to show a loading image when i run an ajax
I have a text link. When the user hovers over the text link, I
I have a link that recieves a dyanamic image via php, and when you
I have a link that takes me to an image. How would I go
I have image map that can I move, but this map will be so
I have an image that I want to position in the right and repeat
I have an image that is served as static file using Nginx, but I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.