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 7719935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:32:21+00:00 2026-06-01T03:32:21+00:00

Html Structure <a> <span> <!– Span has width & height –> <img> </span> <span>

  • 0

Html Structure

<a>
   <span>   <!-- Span has width & height -->
   <img>
   </span>
   <span> Some text <span>
</a>

Anchor is not clickable only in IE7, I know the issue happens because of hasLayout, if we remove height & width of the span, it will work fine.

But I need to make it work with out removing height & width.

EDIT: You can fiddle with an example here: http://jsfiddle.net/rxcAb

  • 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-06-01T03:32:22+00:00Added an answer on June 1, 2026 at 3:32 am

    CSS Only Solution

    Tomas-I modified your fiddle into a working example. I changed your code to use a span inside the a tag because it is invalid to have a standard block level element (a div) in an inline element (an a tag). Giving the a tag layout (I used inline-block) and then setting a position:relative on that span with a z-index: -1 pushes the span “below” the a tag and makes IE7 recognize the a tag as active again. Below is the modified code used in my fiddle. You might want to set up a more generic class name than my ie7AFix (you probably will also want to just target IE7 for those CSS properties that are necessary for it only). I assume you are varying the width and height by images, and hence why you have those as inline styling.

    HTML

    <a href="http://www.google.com/" class="ie7AFix">
      <span style="width:222px; height: 150px;">
        <img src="http://artax.karlin.mff.cuni.cz/~ttel5535/aviff/photos/scaled/P000137_220x148.jpg" style="width:220px; height: 148px;">
      </span>
    </a>
    

    CSS

    a.ie7AFix {
        display: inline-block; /*needs to set hasLayout; zoom: 1, etc.*/
    }
    
    .ie7AFix span {
        border: solid #666 4px;
        display: block;
        position: relative;
        z-index: -1;
        line-height: 0; /*this made it "cross browser" eliminating extra bottom space*/
    }
    
    .ie7AFix img { border: 1px solid red; }
    

    Updated Fiddle with line-height added to make “cross browser” if one does not want to target IE7 only. I kept the width and height in the span html above, only because the original question (by both gviswanathan and Tomas) requested it. If you don’t need to set the dimensions on the span for some reason, but are simply trying to do a double border on the image, then thirtydot’s answer given in the comment’s below is much simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Simple HTML Structure: <html> <body> <p id=5> My Text Qoted Here - <span
//html structure <div id='outer'> <div id='inner'> </div> </div> I am adding some data to
I have the following html structure <div> text 1 <div> text 2 <div> text
i have html structure like this <div> <span class=ic> <span class=ic>12345</span> </span> </div> i
I have a large HTML document which has roughly this structure: <div id=a> <!--
<html> <head> </head> <body> <div> <a href=http://www.google.com> <span>title<br></span> <span>description<br></span> <span>some url</span> </a> </div> </body>
I have a HTML structure: <div class=mydiv>xx <span>test1</span> <span>test2</span> <div class=inerdiv> <span>inner span</span> </div>
There has been times where I need to convert an old HTML structure to
So i have this structure html <span class=label data=data/support_icon.png> <span class=title>1 User/Location - 8Am
I have one html structure: enter code here <ul> <li><span>aaa</span> <div> <ul> <li><span>bbb</span> </li>

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.