HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Left align images leave gap in table
Post new topic   Reply to topic    HTML Help Forum Index -> General HTML
View previous topic :: View next topic  
Author Message
asenft



Joined: 05 Oct 2008
Posts: 2

PostPosted: Sun Oct 05, 2008 1:48 pm     Left align images leave gap in table Reply with quote

There is a small vertical gap on the left side of this image using IE 7.0. It does the same thing for right aligned images too. It looks fine under Mozilla. Any clue of fix or bug?

link to below code:
http://www.rosegarden.ws/test.html


----------------------------------------------------
<html>
<body>


<table border=1 cellspacing=0 cellpadding=0 align=center>
<tr>
<td><img src="/images/cross-yellow.jpg" border="0" width=40 height=40 align="left">Small gap on the left</td>
</tr>
<tr>
<td><img src="/images/cross-yellow.jpg" border="0" width=40 height=40 align="right">Small gap on the right</td>
</tr>
</table>


</body>
</html>
PayneLess Designs



Joined: 28 Feb 2007
Posts: 1274
Location: Biloxi, MS

PostPosted: Sun Oct 05, 2008 3:52 pm     Reply with quote

That's an IE bug that's usually not worth fixing and what happens when you use tables for page layouts. To really do it right, you'll notice the below code puts the images right up next to the td borders as it should and that the td border does not interfere with the actual table border.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title></title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<style type="text/css">
* { margin: 0; padding: 0; border: 0; }
table { width: 200px; margin: 0 auto; border: 1px solid #f00; text-align: center; }
td { width: 200px; border: 1px solid #f00; }
</style>
</head>
<body>
<table summary="">
<tr>
<td><img src="http://www.rosegarden.ws/images/cross-yellow.jpg" style="width: 40px; height: 40px; float: left; clear: both; border: 0;" alt="Cross Yellow">Small gap on the left</td>
</tr>

<tr>
<td><img src="http://www.rosegarden.ws/images/cross-yellow.jpg" style="width: 40px; height: 40px; float: right; clear: both; border: 0;" alt="Cross Yellow">Small gap on the right</td>
</tr>
</table>
</body></html>


The code validates as does the CSS.
asenft



Joined: 05 Oct 2008
Posts: 2

PostPosted: Mon Oct 06, 2008 5:43 am     That worked Reply with quote

Obviously that was sample code that I threw up there but the original had an old Doctype. I updated that to yours and now everything is aligned.

Thank you!!!!
PayneLess Designs



Joined: 28 Feb 2007
Posts: 1274
Location: Biloxi, MS

PostPosted: Mon Oct 06, 2008 6:13 am     Reply with quote

You're very welcome.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> General HTML All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial