table layout has gap between row element in Firefox

Hi, experts:
I use table to layout my web design. The result in IE is what I want, but the result in Firefox is unexpected. There is a gap between the first row and second row in Firefox, what should I do?
<!doctype html public "-//W3C/DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=big5">
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<title>Studio</title>
	</head>
<body>
 
<div align="center">
	<table border="0" width="916" id="table1" cellpadding="0" bgcolor="#FFFFFF" style="border-collapse: collapse">
		<tr>
			<td width="33">
			<img border="0" src="images/left_bg.png" width="33" height="348"></td>
			<td width="850"></td>
			<td width="33">
			<img border="0" src="images/right_bg.png" width="33" height="348"></td>
		</tr>
		<tr>
			<td width="33" valign="top" background="images/lbg.png" align="right"></td>
			<td width="850" valign="top">
			<p><p><p><p><p></td>
			<td width="33" valign="top" background="images/rbg.png" align="left"></td>
		</tr>
	</table>
</div>
 
</body>
 
</html>
 
 
style.css
 
body {
	margin: 0px;
	background-image: url(../images/bg.gif);
	background-repeat: repeat-x;
}

Open in new window

gap.JPG
TKDAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aherpsCommented:
Hi,

In your style sheet, add the following:

table {
  border-collapse: separate;
  border-spacing: 0;
  *border-collapse: collapse; /* hack is needed for IE7 also */
}

Than you can remove the style parameter from your <table> tag.

border-collapse: collapse; is only recognised by IE. All others will use border-collapse: seperate; border-spacing: 0;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
David S.Commented:
@aherps

Why not just give all browsers border-collapse:collapse?
0
aherpsCommented:
because border-collapse isn't respected by all browsers
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

TKDAuthor Commented:
The result is the same in FireFox.

<!doctype html public "-//W3C/DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=big5">
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<title>Studio</title>
	</head>
<body>
 
<div align="center">
	<table border="0" width="916" cellpadding="0" bgcolor="#FFFFFF">
		<tr>
			<td width="33">
			<img border="0" src="images/left_bg.png" width="33" height="348"></td>
			<td width="850"></td>
			<td width="33">
			<img border="0" src="images/right_bg.png" width="33" height="348"></td>
		</tr>
		<tr>
			<td width="33" valign="top" background="images/lbg.png" align="right"></td>
			<td width="850" valign="top"><br></td>
			<td width="33" valign="top" background="images/rbg.png" align="left"></td>
		</tr>
	</table>
</div>
 
</body>
 
</html>
 
 
body {
	margin: 0px;
	background-image: url(../images/bg.gif);
	background-repeat: repeat-x;
}
 
table {
	border-collapse: separate;
	border-spacing: 0;
  	*border-collapse: collapse; /* hack is needed for IE7 also */
}

Open in new window

0
TKDAuthor Commented:
I find where the problem is.

I change
<!doctype html public "-//W3C/DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

Open in new window

to

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

The problem is solved.


0
TKDAuthor Commented:
Excellent
0
David S.Commented:
@TKD

These explain why that change fixed it and the two better solutions:
http://gtwebdev.com/workshop/gaps/image-gap.php
http://developer.mozilla.org/en/docs/Images,_Tables,_and_Mysterious_Gaps

@aherps

So among the browsers that don't support it, which ones are new enough for you to care about?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Browsers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.