RSS Forums RSS

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

Please support our HTML and CSS advertiser: Programming Forums
Thread Solved
Reply
Posts: 2,896
Reputation: VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of 
Solved Threads: 366
VernonDozier VernonDozier is offline Offline
Posting Maven

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

  #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 2:45 pm.
Attached Images
File Type: gif TableExperiment.GIF (5.4 KB, 4 views)
AddThis Social Bookmark Button
Reply With Quote  
Posts: 39
Reputation: cfajohnson is an unknown quantity at this point 
Solved Threads: 10
cfajohnson cfajohnson is offline Offline
Light Poster

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

  #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  
Posts: 2,896
Reputation: VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of 
Solved Threads: 366
VernonDozier VernonDozier is offline Offline
Posting Maven

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

  #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  
Posts: 75
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

  #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 9:02 pm.
If I have been helpful add to my reputation!
Reply With Quote  
Posts: 2,896
Reputation: VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of VernonDozier has much to be proud of 
Solved Threads: 366
VernonDozier VernonDozier is offline Offline
Posting Maven

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

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the HTML and CSS Forum
Views: 1274 | Replies: 4 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 12:34 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC