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!

tables and cellspacing/padding with CSS

Status
Not open for further replies.

Stoemp

Programmer
Sep 25, 2002
389
BE
Hi,

I'm designing a newsletter to send to all our customers, and I wanted to validate the code in the W3C validator. The attributes cellspacing and cellpadding are not used anymore and should be done with CSS now. I tried and managed to put it all in CSS. There's only one slight difference. There seems to be a spacer of 1 pixel around my table cells. An example can be viewed at:

Anyone an idea what goes wrong here? I really don't see it.

Thanks,
Steven
 
Hmmm, according to W3C you are wrong. XHTML 1.0 Strict Doctype, this is what it says about table attribute list:
Code:
<!ATTLIST table
  %attrs;
  summary     %Text;         #IMPLIED
  width       %Length;       #IMPLIED
  border      %Pixels;       #IMPLIED
  frame       %TFrame;       #IMPLIED
  rules       %TRules;       #IMPLIED
  cellspacing %Length;       #IMPLIED
  cellpadding %Length;       #IMPLIED
  >
Anyway, adding cellspacing and cellpadding to the table, I got the desired result and the page validated. I have however changed your doctype declaration since yours was not pointing to the correct URI.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]

<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en">

<head>
	<title>Biognost Research Promotions</title>

	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<link href="[URL unfurl="true"]http://www.biognost.be/include/stylesIE.css"[/URL] type="text/css" rel="stylesheet" />
</head>
<body style="background-color: #ffffff; margin-top: 0px; text-align: center;">
<table style="border: black 1px solid; padding: 0px; width: 600px; border-collapse: collapse;" cellpadding="0" cellspacing="0">
<tbody>
<tr><td><a href="[URL unfurl="true"]http://www.biognost.be/research/"><img[/URL] src="[URL unfurl="true"]http://www.biognost.be/maps/researchHeaderNieuwsbrief.jpg"[/URL] width="600" style="border: none;" alt="Biognost Research" /></a></td></tr>
<tr><td ><img style="height: 2px; border: none; width: 600px;" src="[URL unfurl="true"]http://www.biognost.be/maps/line_top1.gif"[/URL] alt="line" /></td></tr>
<tr><td style="height: 22px;" class="tdLichtGrijs"><p class="pBodyTekstCentered"><b>Biognost Research News (12/05/2004)</b></p></td></tr>
<tr><td><img style="height:2px; border: none; width: 600px;" src="[URL unfurl="true"]http://www.biognost.be/maps/line_top2.gif"[/URL] alt="line" /></td></tr>
<tr><td style="padding-top: 20px; padding-left: 20px; padding-right: 20px; padding-bottom: 20px;"><p class="pBodyTekst">Dear Researcher,<br /><br />This month we would like to inform you about the range of products we supply and some of our very popular products you might not know we are distributing.</p></td>
</tr>
</tbody>
</table>
</body>
</html>
 
Very weird. The first time I validated the validator told me he could not recognize the cellspacing and cellpadding attribs. Well, it's fixed. Thanks a lot m8!
 

Incidentally, I've noticed that the W3C have been changing their validation services around lately. One day, every page we tried to validate for CSS compliance failed, as they'd seemingly upped the standards checked by default to v3, instead of v2. That didn't last too long (guess everyone got severely hacked off by it)... But it may be a similar story with the XHTML validation service.

Dan
 
I found the problem... one uppercase character that I was practically unable to see in notepad. It always lurks in small corners...

Thx for the help guys,

Steven
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top