X
Tap here to go to the mobile version of the site.
Your Firefox is out of date and may contain a security risk! Upgrade Firefox

Support Forum

Image in an <a> element doesn't link in a <div> element set

Posted

The following code works in other browsers but not FF, and it stopped working in FF probably around version 14 or so (when I first noticed). \ = angle bracket

<div style="float:left;width:350px;">
<a href="index.html"><img src="red.jpg" alt="red" width="349" height="100" align="left" border="0"></a>
</div>

<div style="position:relative;top:20px;">
<h2 align="center">Text Moved to Right<br>
to test anchor link</h2>
</div>

If you mouse over the red box image area, the anchor only works at the top and bottom margin of the image. If you remove the second <div>, the anchor element works ok. This works with other browsers I've tried, just not with FF.

I tried setting display:block for the <img> element to no avail. Maybe something changed in the browser's main rendering engine that's now causing this.

Thanks.

Modified by cor-el

Additional System Details

Installed Plug-ins

  • The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
  • Shockwave Flash 11.4 r402
  • Adobe PDF Plug-In For Firefox and Netscape "9.5.2"
  • RealJukebox Netscape Plugin
  • RealPlayer(tm) HTML5VideoShim Plug-In
  • RealPlayer(tm) LiveConnect-Enabled Plug-In
  • 6.0.12.732
  • Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
  • DRM Netscape Network Object
  • Npdsplay dll
  • DRM Store Netscape Plugin

Application

  • User Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20100101 Firefox/17.0

More Information

Not machine dependent.

Question owner

Fixed the code in the previous post.

Modified by rybrns

cor-el
  • Top 10 Contributor
  • Moderator
10738 solutions 96600 answers

You may need a clear div because you have floating content.

A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.

The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.