Skip to content

Instantly share code, notes, and snippets.

@marshall007
Created April 4, 2012 18:50
Show Gist options
  • Select an option

  • Save marshall007/2304699 to your computer and use it in GitHub Desktop.

Select an option

Save marshall007/2304699 to your computer and use it in GitHub Desktop.
[HTML] what's the most semantically-sound way of creating a header column.

CSS

table, td, th {
	border: 1px solid black;   
}

thead {
	float: left;   
}

tbody {
	float: right;   
}

th, td {
	display: block;
}

th {
	font-weight: bold;   
}​

HTML

<table>
	<thead>
		<tr>
			<th>a</th>
			<th>b</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>1</td>
			<td>2</td>
		</tr>
	</tbody>
</table>​

CSS

table, td, th {
	border: 1px solid black;   
}

th {
	font-weight:bold;
}

HTML

<table>
	<tbody>
		<tr>
			<th scope="row">a</th>
			<td>1</td>
		</tr>
		<tr>
			<th scope="row">b</th>
			<td>2</td>
		</tr>
	</tbody>
</table>​
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment