Because semantically they’re a HEADING?!? Wow, that’s some real 1990’s thinking there… Again as I’ve said a dozen times, if you are choosing tags based on what they look like, you’re choosing the wrong tags!
Can’t say I’ve ever seen said behavior from a table – is this issue specific to one browser or something?
Lemme see here… first change that into how I’d code it; which means proper doctype instead of being in transition from 1997 to 1998, losing the charset declaration in the CSS since it’s invalid for CSS to contain anything other than ASCII7, get a media type on it, make the formatting make SENSE, oh wait… yeah. DUH.
Border-spacing – can’t be trusted cross browser… you pretty much have to use cell-spacing.
Of course you’re also using the giant fat/bloated reset that targets a bunch of things you either shouldn’t be using, or that can CAUSE problems instead of fixing them.
… and that includes THEAD and TBODY, which are to themselves NON-RENDERING elements. Resetting them triggers that they should be shown! That’s probably your issue.
Oh, I’d also probably set scope=“col” on the “THEAD TH”, then change the first column of TD in TBODY into TH, setting them to scope=“row” since they appear to be headers/topic of the information that follows them.
I’d have coded that thus:
Markup:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
lang="en"
xml:lang="en"
><head>
<meta
http-equiv="Content-Type"
content="text/html; charset=utf-8"
/>
<meta
http-equiv="Content-Language"
content="en"
/>
<link
type="text/css"
rel="stylesheet"
href="screen.css"
media="screen,projection,tv"
/>
<title>Table Test</title>
</head><body>
<table cellspacing="10" class="testTable">
<thead>
<tr>
<th scope="col">Brand</th>
<th scope="col">Price</th>
<th scope="col">Power Source</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Vertical Align</th>
<td>$247.00</td>
<td>Mechanical</td>
</tr>
<tr>
<th scope="row">Vertical Align Baseline</th>
<td>$370.00</td>
<td>Mechanical</td>
</tr>
<tr>
<th scope="row">Vertical Align Middle</th>
<td>$247.00</td>
<td>Mechanical</td>
</tr>
<tr>
<th scope="row">Vertical Align Middle</th>
<td>$370.00</td>
<td>Mechanical</td>
</tr>
</tbody>
</table>
</body></html>
then the CSS
html,body,address,blockquote,div,
form,fieldset,caption,
h1,h2,h3,h4,h5,h6,
hr,ul,li,ol,ul,
table,tr,td,th,p,img {
margin:0;
padding:0;
}
img,fieldset {
border:none;
}
body {
font:normal 85%/150% arial,helvetica,sans-serif;
}
table{
font-size:100%;
}
.testTable {
margin: 40px;
}
td,th {
border:2px solid blue;
padding:10px;
}
tbody th {
font-weight:normal;
text-align:left;
}
tbody td {
text-align:center;
}
Though it’s odd, I’m unable to recreate your problem in ANY browser here using your code… Again, what browser is showing you that oddball formatting as I’m not seeing it here in Opera, FF, Safari, Chrome or any version of IE… though IE7 and lower ignores border-spacing, and FF applies an extra 15% to it on large fonts/120dpi setting (which is odd since it ignores that for %/em – so it’s applying something to it in PT?!?)