locked
Strange Behavior w/an "_" being added after an image wrapped in a link button RRS feed

  • Question

  • User-1161063654 posted

    Folks,

    I was wondering if anyone else has seen this behavior in IE 6 and 7?  I have an image wrapped in a link button,  

    <asp:LinkButton ID="submit" OnClientClick="javascript:return validateUnsubscribe();" OnClick="submit_Click" style="margin-right:140px;" runat="server">
         <img id="submitimg" src="images/btn_unsub.gif" alt="Unsubscribe" width="120" height="30" border="0" />
    </asp:LinkButton>
     
     For some reason in IE 6 and 7 there is an "_" that is showing up after the btn_unsub.gif on the page.  What is even stranger, when I view the source of the page, there is no "_" being rendered in the markup.   
    <a onclick="javascript:return validateUnsubscribe();" id="ctl00_ContentPlaceHolderMaster_submit" href="javascript:__doPostBack('ctl00$ContentPlaceHolderMaster$submit','')" style="margin-right:140px;">
       <img id="submitimg" src="images/btn_unsub.gif" alt="Unsubscribe" width="120" height="30" border="0" />
    </a>

     This does not happen in Firefox.  Looking at the ASP.NET markup I do not see any irregular breaks that would cause the "_" to show up.  Is IE rendering an additional space after the image that would cause it to show up?

    Any insight is greatly appreciated.  Thanks in advance!

     - Jesse
     

    Monday, March 3, 2008 1:48 PM

Answers

  • User1340541308 posted

    Actually, because the image is inside an anchor tag the underline you are seeing is the normal browser underlining of hyperlink text but there is no text so you simply see a one character underline right next to the image. One way to stop this behavior is to put "text-decoration:none" in the style for your linkbutton. That should set the hyperlink to not be underlined which will make the underline after your image go away. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 3, 2008 2:16 PM

All replies

  • User1340541308 posted

    Actually, because the image is inside an anchor tag the underline you are seeing is the normal browser underlining of hyperlink text but there is no text so you simply see a one character underline right next to the image. One way to stop this behavior is to put "text-decoration:none" in the style for your linkbutton. That should set the hyperlink to not be underlined which will make the underline after your image go away. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 3, 2008 2:16 PM
  • User-1161063654 posted

    Worked as expected.  Didn't even think to play with the styling.  Thanks man!

    - Jesse 

    Monday, March 3, 2008 3:08 PM