Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE putting spaces where it shouldn't?!?

Status
Not open for further replies.

irbk

MIS
Oct 20, 2004
578
0
0
US
So I'm working on some one else's code. It's messy as all heck so I go through and format the code the way I like it. For example rather then having
Code:
<table>
  <tr><td>stuff here</td></tr>
</table.
I like my code to look like
Code:
<table>
  <tr>
    <td>
       stuff here
    </td>
  </tr>
</table>
Obvously the above example is very simplified but when the code is more complicated, it's very easy for me to see what is nested in what. All of a sudden, goofy white space was appearing out of no where. Where the browser (IE, it displays correctly in firefox) should be ignoring white space, it's putting in the white space! So in other words
Code:
<tr>
  <td>
    <img src="../images/slices/slice_03.gif" width="690" height="17">
  </td>
</tr>
Is producing a space below the image (where there shouldn't be one). But
Code:
<tr>
  <td>
    <img src="../images/slices/slice_03.gif" width="690" height="17"></td>
</tr>
OR
Code:
<tr>
  <td><img src="../images/slices/slice_03.gif" width="690" height="17"></td>
</tr>
Does NOT produce the space. Any clue why IE is displaying white space where it should be ignoring it?
 
One way of doing this without losing your indentation is to close any tag on the succeeding line:

Code:
<tr
	><td
		><img src="../images/slices/slice_03.gif" width="690" height="17"
	></td
></tr>

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Note: I don't think you need to do this for all tags... for example, I doubt it's necessarty to do this for TR elements, so you might find this is all you need:

Code:
<tr>
    <td
        ><img src="../images/slices/slice_03.gif" width="690" height="17"
    ></td>
</tr>

You might even find you don't need it at the start of the TD:

Code:
<tr>
    <td>
        <img src="../images/slices/slice_03.gif" width="690" height="17"
    ></td>
</tr>

Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks for the advice guys. I find it amazing that I've been doing webpages for as long as I have and I've never run across it before except in this one page. Thanks for the input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top