Welcome to Interactive Programming Forums, where you can ask questions, receive answers from other members of the community, post code snippets and post exercies.

Problem Making A Table

+17 votes
I am trying to make a table in HTML II I try many ways to get around it but to no avail, could someone please help:

"Create one 2 x 2 table that includes a table header for each column"
At first I tried doing this:

<html>
<head>
<title></title>
</head>
<body>
<table border="1">
<tr>
<th>Header 1</th>
<td>1 x 1</td>
<td>1 x 2</td>
</tr>
<tr>
<th>Header 2</th>
<td>2 x 1</td>
<td>2 x 2</td>
</table>
</body>
</html>

With no luck, I tried this next :

<html>
<head>
<title></title>
</head>
<body>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>1 x 1</td>
<td>1 x 2</td>
</tr>
<tr>
<td>2 x 1</td>
<td>2 x 2</td>
</tr>
</table>
</body>
</html>
posted 12 years ago in HTML by team.kurt1 (1,120 points)

1 Answer

+2 votes
Hi,

The table header is already a row with two columns so simply create one more row with two columns will make a 2 x 2 table.
Please see below example:

<html>
<head>
<title></title>
</head>
<body>
<table border="1">
<tr>
<th>Header (1x1)</th>
<th>Header (1x2)</th>
</tr>
<tr>
<td>2x1</td>
<td>2x2</td>
</tr>
</table>
</body>
</html>
answered 12 years ago by codeadmin (113,880 points)
Thanks guys!

Related questions

+2 votes
1 answer
posted 12 years ago in HTML by waseem.shah20 (1,350 points)
0 votes
0 answers
posted 10 years ago in HTML by sdubois (8,090 points)
+10 votes
1 answer
posted 12 years ago in HTML by Milad1991 (2,750 points)
+10 votes
1 answer
posted 12 years ago in HTML by Sigurður Jónsson (6,630 points)