views:

84

answers:

2

I have an issue where Internet Explorer is generating an additional br element that is not in my source. The additional br effects the page's layout and is visible when using the developer tool. I've tried removing all hard returns between the surrounding elements but the additional br persists. Firefox and Chrome do not have this issue. Ideas on what I can do to fix the issue?

Instead of

First line.
Second line.

I get

First line

Second line.

Code Example

    <asp:ImageButton ID="RemoveItem" AlternateText="Remove Item" 
        ImageUrl="~/img/buttons/remove.png" runat="server" CssClass="remove"
        CommandName="Remove" OnCommand="RemoveCartItem_Command" />
    <br runat="server" id="TotalBreak" />
    <span class="fieldlabel">Total</span>

And what I end up with (... used to show I've shortened rendered ids)

<input id="...RemoveItem" class="remove" alt="Remove Item"
       src="img/buttons/remove.png" type=image name="...RemoveItem" />
<br id="...TotalBreak"/>
<br/>
<span class="fieldlabel">Total</span>
+1  A: 

Try a CSS reset to remove browser defaults.

buckbova
+1  A: 

It's probably due to line-height or another default in the browser's default style sheet. Like buyckbova said, you should use a CSS reset. Try Eric Meyer's, it's thorough: http://meyerweb.com/eric/tools/css/reset/

Cole
I am using Meyer's CSS Reset but am still seeing the issue. :( I could be overriding `line-height` or another setting somewhere.
ahsteele
I haven't figured out which CSS property I am overwriting but turning off all CSS removes the extra `br` so I am sure that you are right. Now to find the offender.
ahsteele
If you put in Firebug Lite, you can see the trace of all styles for the element, which should help.
Cole