| | |
Table cells have small gap between them that I want to get rid of
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved
![]() |
•
•
Join Date: Jan 2008
Posts: 3,756
Reputation:
Solved Threads: 491
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.
html Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Table Experiment</title> <style type="text/css"> <!-- body { background-color: #FFFFFF; } --> </style></head> <body> <table width="600" height="600" border="0"> <tr> <td bgcolor="#0000FF"> </td> <td bgcolor="#FF0000"> </td> <td bgcolor="#00FF00"> </td> </tr> <tr> <td bgcolor="#FF0000"> </td> <td bgcolor="#00FF00"> </td> <td bgcolor="#0000FF"> </td> </tr> <tr> <td bgcolor="#00FF00"> </td> <td bgcolor="#0000FF"> </td> <td bgcolor="#FF0000"> </td> </tr> </table> <p> </p> </body> </html>
Last edited by VernonDozier; Jan 12th, 2009 at 3:45 pm.
•
•
Join Date: Dec 2008
Posts: 63
Reputation:
Solved Threads: 13
•
•
•
•
html Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
Why XHTML and why transitional?
•
•
•
•
html Syntax (Toggle Plain Text)
<head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Table Experiment</title> <style type="text/css"> <!--
The HTML comment hasn't been necessary since Netscape 4.
html Syntax (Toggle Plain Text)
table { border-collapse: collapse; }
•
•
Join Date: Jan 2008
Posts: 3,756
Reputation:
Solved Threads: 491
•
•
•
•
Why XHTML and why transitional?
The HTML comment hasn't been necessary since Netscape 4.
That did it. Thank you.
•
•
Join Date: Oct 2008
Posts: 76
Reputation:
Solved Threads: 6
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.
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!
![]() |
Other Threads in the HTML and CSS Forum
- Previous Thread: IIS FTP
- Next Thread: How do I create a cool navigation menu using Adobe Photoshop?
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form google griefers hackers hitcounter hover html ie7 ie8 iframe image images internet intranet iphone javascript jpeg layout macbook maps mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning scroll seo shopping swf swf. textcolor timecolor titletags url urlseparatedwords visualization web webdevelopment webform website windows7






