Table cells have small gap between them that I want to get rid of

Thread Solved
Reply

Join Date: Jan 2008
Posts: 3,756
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 491
Featured Poster
VernonDozier VernonDozier is online now Online
Senior Poster

Table cells have small gap between them that I want to get rid of

 
0
  #1
Jan 12th, 2009
Hi, I'm creating a maze game. The layout is basically a big 21 x 21 square, with 441 (21 times 21) smaller squares inside of it. Each square will be a different color, representing a wall, a character, a passage, etc., so I figured I'd make a 21 x 21 table. However, when I do so, there is a small gap between each cell where the white background shows through. I'd like all the cells to jut against each other with no gaps so that the white background cannot be seen between cells. Is this possible and if so, how? I took a screenshot (attached), which shows the thin white lines between cells that I would like to get rid of, and my code is below (simple 3 x 3 table with different colors for adjacent cells). It's hard to see with the small version, but if you make it full-size, you see the thin white lines I am trying to remove more easily. Thank you.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Table Experiment</title>
  6. <style type="text/css">
  7. <!--
  8. body {
  9. background-color: #FFFFFF;
  10. }
  11. -->
  12. </style></head>
  13.  
  14. <body>
  15. <table width="600" height="600" border="0">
  16. <tr>
  17. <td bgcolor="#0000FF">&nbsp;</td>
  18. <td bgcolor="#FF0000">&nbsp;</td>
  19. <td bgcolor="#00FF00">&nbsp;</td>
  20. </tr>
  21. <tr>
  22. <td bgcolor="#FF0000">&nbsp;</td>
  23. <td bgcolor="#00FF00">&nbsp;</td>
  24. <td bgcolor="#0000FF">&nbsp;</td>
  25. </tr>
  26. <tr>
  27. <td bgcolor="#00FF00">&nbsp;</td>
  28. <td bgcolor="#0000FF">&nbsp;</td>
  29. <td bgcolor="#FF0000">&nbsp;</td>
  30. </tr>
  31. </table>
  32.  
  33. <p>&nbsp;</p>
  34.  
  35. </body>
  36. </html>
Last edited by VernonDozier; Jan 12th, 2009 at 3:45 pm.
Attached Images
File Type: gif TableExperiment.GIF (5.4 KB, 4 views)
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 63
Reputation: cfajohnson is an unknown quantity at this point 
Solved Threads: 13
cfajohnson cfajohnson is offline Offline
Junior Poster in Training

Re: Table cells have small gap between them that I want to get rid of

 
0
  #2
Jan 12th, 2009
Originally Posted by VernonDozier View Post
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">

Why XHTML and why transitional?
  1. <head>
  2. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  3. <title>Table Experiment</title>
  4. <style type="text/css">
  5. <!--
  6.  

The HTML comment hasn't been necessary since Netscape 4.
  1. body {
  2. background-color: #FFFFFF;
  3. }
  1. table
  2. {
  3. border-collapse: collapse;
  4. }
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,756
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 491
Featured Poster
VernonDozier VernonDozier is online now Online
Senior Poster

Re: Table cells have small gap between them that I want to get rid of

 
0
  #3
Jan 12th, 2009
Originally Posted by cfajohnson View Post

Why XHTML and why transitional?

The HTML comment hasn't been necessary since Netscape 4.
Dreamweaver 8 put all of that there. Is that bad?

Originally Posted by cfajohnson View Post
  1. table
  2. {
  3. border-collapse: collapse;
  4. }
That did it. Thank you.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 76
Reputation: ccube921 is an unknown quantity at this point 
Solved Threads: 6
ccube921 ccube921 is offline Offline
Junior Poster in Training

Re: Table cells have small gap between them that I want to get rid of

 
0
  #4
Jan 12th, 2009
Hi, its simple just add this by your table declaration: cellspacing="0",
so our table declaration will look like this:
<table width="600" height="600" border="0" cellspacing="0">

That should just about do it.

Sorry, didnt notice above post.
Last edited by ccube921; Jan 12th, 2009 at 10:02 pm.
If I have been helpful add to my reputation!
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,756
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 491
Featured Poster
VernonDozier VernonDozier is online now Online
Senior Poster

Re: Table cells have small gap between them that I want to get rid of

 
0
  #5
Jan 12th, 2009
Originally Posted by ccube921 View Post
Hi, its simple just add this by your table declaration: cellspacing="0",
so our table declaration will look like this:
<table width="600" height="600" border="0" cellspacing="0">

That should just about do it.
Yep. That did the trick too. Thanks.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC