I'm studying out of a book for HTML, XHTML, & CSS. We just went over building a basic table. here's my code so far below, validated and working just fine:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="content-type" content="text/xml; charset=utf-8" />

		<title>basicTable.html</title>
	</head>
	<body>
		<h1>A Basic Table</h1>
		<h2>XHTML Super Heroes</h2>
		<table border = "5">
			<tr>
				<th>Hero</th>
				<th>Power</th>
				<th>Nemesis</th>
			</tr>
			
			<tr>
				<td>The XMLator</td>
				<td>Standards compliance</td>
				<td>Sloppy Code Boy</td>
			</tr>
			
			<tr>
				<td>Captain CSS</td>
				<td>Super-layout</td>
				<td>Lord Deprecated</td>
			</tr>
			
			<tr>
				<td>Browser Woman</td>
				<td>Mega-Compatibility</td>
				<td>Ugly Code Monster</td>
			</tr>
			
		</table>
	</body>
</html>

(forgive the subject matters in the table..lol author's choice here). Anyway, my question revolves around this statement he made and there is no example to help me understand what he means:

"Headings don't have to be on the top row. If you want headings on the left, just put a <th></th> pair as the first element of each row. You can have headings at both the top and the left, if you want. In fact, you can have headings anywhere, but it usually makes sense to put headings only at the top or left."

so is it something similar to this?

<tr>
<th></th>
<td></td>
<td></td>
</tr>

the 'first element' reference is messing me up here because I'm not sure as to where that is in my code when he refers to it. I would appreciate any help, and you don't have to recopy my whole code, just the relevant part of the table.. thanks for your help everyone!

Recommended Answers

All 2 Replies

Yes, that is what is meant. You could change "<td>The XMLator</td>" to "<th>The XMLator</th>" and then use CSS to change the color of all "th" items, for instance.

ah alright. I knew it was something simple, but after playing around for a minute or two, I didn't pull up what I had been seeing in my mind. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.