Connecting Tech Pros Worldwide Help | Site Map

Text over an Image with hyperlink

Member
 
Join Date: Jul 2007
Posts: 52
#1: Aug 10 '09
I have an image and a span inside a hyperlink that I need to appear on top of one another. Can anyone tell me why, when I use relative positioning on my span it causes the text to move to the correct spot but the line from the hyperlink stays at it's original position?

Here is the code in question...
Expand|Select|Wrap|Line Numbers
  1. <div class="menuBarStyle">
  2.     <a href="projects.aspx" onmouseover="buttonOver('projectButton', '../images /AlienDa3Over.gif')" onmouseout="buttonOver('projectButton', '../images/AlienDa3.gif')">
  3.      <img name="projectButton" src="http://bytes.com/submit/images/AlienDa3.gif" class="projectButtonStyle" alt="Projects"  />
  4.     <span class="projectLabelStyle">Projects</span>
  5.     </a>
  6.     </div>
and these are the styles used...

Expand|Select|Wrap|Line Numbers
  1. .menuBarStyle{
  2.     height:50px;
  3. }
  4.  
  5. .projectButtonStyle{
  6.     position:absolute;
  7.     left:370px;
  8. }
  9.  
  10. .projectLabelStyle
  11. {
  12.     position:relative;
  13.     z-index:1;
  14.     left:380px;
  15.     top:5px;
  16.     color:#999999
  17. }
annnd here's the page on my site...

My Site
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,559
#2: Aug 10 '09

re: Text over an Image with hyperlink


Because the anchor is not the span. You relocated the span but that is not the anchor and it's the anchor that gets underlined.
Reply