Regarding the first question: create classes that you assign to each col
umn. Rather simple.
The aligning of text is a bit more difficult, as you can only assign a few properties to table columns as a whole. In this case, one solution would be to use the nth-child
pseudo-class, but that's a CSS 3 specific feature that's not working in any of the current versions of Internet Explorer. As this answer proposes, you can also use the +
combinator to style adjacent columns. That's a CSS 2.1 feature supported by IE >= 7.
<!DOCTYPE html>
<head>
<meta charset=UTF-8>
<title>Column styling</title>
<style>
table {
table-layout: fixed;
width: 1000px;
}
.firstColumn {
width: 20%;
background: #ccc;
}
.otherColumns {
width: 40%;
background: #eee;
}
td { text-align: left }
td+td { text-align: right }
td+td+td { text-align: center }
</style>
</head>
<body>
<table>
<col class="firstColumn">
<col class="otherColumns">
<col class="otherColumns">
<tr>
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
<tr>
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
<tr>
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
</table>
</body>
</html>