HTML - spaces in table

  • Inito
  • Graduate
  • Graduate
  • User avatar
  • Posts: 223

Post 3+ Months Ago

I'm having an issue with HTML tables.

When i post an image in a cell, it creates like 2 pixels space under it.
And i thought i tried all:

Code: [ Select ]
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="v1.jpg" width="96" height="18" hspace="0" vspace="0">
</td>
</tr>
</table>
  1. <table border="0" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <td><img src="v1.jpg" width="96" height="18" hspace="0" vspace="0">
  4. </td>
  5. </tr>
  6. </table>


What I noticed, is that i cant select the image (clicking, holding, then moving the mouse) without the space under it.

Any theories?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • RichB
  • Guru
  • Guru
  • User avatar
  • Posts: 1121
  • Loc: Boston

Post 3+ Months Ago

Try removing the line break before the closing </td> like this:
Code: [ Select ]
<table border="2" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><img src="v1.jpg" width="96" height="18"></td>
</tr>
</table>
  1. <table border="2" width="100%" cellspacing="0" cellpadding="0">
  2. <tr>
  3. <td><img src="v1.jpg" width="96" height="18"></td>
  4. </tr>
  5. </table>

The browser is supposed to ingore newline characters as far as I know, but IE seems to be noticing it in this case. Perhaps it's a bug, because it looks fine in Mozilla either way.
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Try adding border="0" to your image tag. The image tag does not inherit the border="0" in your table element. Although it is invisible, the 2 pixel border is still there unless you specify otherwise. Also the hspace and vspace are not valid attributes for the img tag. They are both deprecated in HTML. I would also make the td element the same width and height as the image and like Rich B said remove the line break:

Code: [ Select ]
<td width="96" height="18"><img src="v1.jpg" width="96" height="18" border="0"></td>
  • Inito
  • Graduate
  • Graduate
  • User avatar
  • Posts: 223

Post 3+ Months Ago

Thanks, but no, its still the same.
I really don't have a clue.

And ATNO, what do you mean by deprecated? Last time i checked they were still supported.
  • allgoodpeople
  • Proficient
  • Proficient
  • User avatar
  • Posts: 379
  • Loc: here

Post 3+ Months Ago

Inito wrote:
Thanks, but no, its still the same.
I really don't have a clue.

And ATNO, what do you mean by deprecated? Last time i checked they were still supported.


I believe deprecated means that even though they still work and are supported, they're on their way out. Future versions of code and browsers will stop supporting them, so it's a good idea to get out of the habit of using them now and begin transitioning to "proper" code.

You can follow this link: http://www.w3schools.com/tags/tag_applet.asp for an example of a deprecated tag, as well as a small javascript window that defines deprecated a little better.

I think that's right. Anyone care to elaborate?

mark
[/url]
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

You have it correct allgoodpeople. Good reference link and example.

Also read Microsofts standards paragraph in this link:
http://msdn.microsoft.com/library/defau ... hspace.asp

It talks about hspace specifically. And the same below for vspace:
http://msdn.microsoft.com/library/defau ... vspace.asp
  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Posts: 23456
  • Loc: Woodbridge VA

Post 3+ Months Ago

Inito - do you have a link to the page you're working on?
  • Inito
  • Graduate
  • Graduate
  • User avatar
  • Posts: 223

Post 3+ Months Ago

I just messed around, and now its gone.
Sorry for your time, and thanks anyway :P

Post Information

  • Total Posts in this topic: 8 posts
  • Users browsing this forum: No registered users and 66 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.