Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Borderless tables?

Status
Not open for further replies.

LaundroMat

Programmer
Dec 2, 2003
67
BE
Hi,

Is it possible to completely remove the borders between table-cells? {border: none} doesn't resolve this, as there is still a 1px line between all <tr>'s and <td>'s (in the bkg colour, if I'm not mistaken).

Are there other style tags that effectively remove these borders?

Thanks in advance
 
I think border-collapse is IE-only. You need to use normal table HTML otherwise:

Code:
<table border="0" cellspacing="0" cellpadding="0">

--James
 
James:

I tested this in IE 6.0.2800, FF 1.0 PR, and NutScrape 7.2. As long as there is a complete doctype, this should work fine.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]

<html>
<head>
<title>new document</title>

<style type="text/css">
body {
	background-color: black;
}

table {
	border: none;
	border-collapse: collapse;
}

td { width: 50px; height: 50px; background-color: red; }
</style>

</head>

<body>
<table>
	<tr><td></td><td></td></tr>
	<tr><td></td><td></td></tr>
	<tr><td></td><td></td></tr>
	<tr><td></td><td></td></tr>
	<tr><td></td><td></td></tr>
	<tr><td></td><td></td></tr>
</table>
</body>

</html>

*cLFlaVA
----------------------------
"Holy crip he's a crapple!
 
Is it border width your trying to kill or cell spacing? You could just do
Code:
<table cellspacing=0px border=0px cellpadding=0px>
[b]...[/b]
</table>

Or similar with CSS.
 
also also remember that the "px" only makes sense in CSS. In HTML you do
Code:
<table cellspacing="0" border="0" cellpadding="0">
To do it in CSS, try
Code:
table, tr, td, th {
   border-collapse: collapse;
   border: 0;
   padding: 0;
   margin: 0;
}
(Note that you don't actually need the "px", as 0 is 0 whatever units you're using!)

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top