Align Text Left in CSS
But you don't have to set the left
value for paragraphs - they are aligned to the left by default. However, there are elements that are centered by default (for example, the th
tags that make the table header cell). And for them, left alignment may be required. Let's do this:
<table border="1">
<tr>
<th>Name</th>
<th>Surname</th>
<th>Salary</th>
</tr>
<tr>
<td>John</td>
<td>Smith</td>
<td>200$</td>
</tr>
<tr>
<td>Nick</td>
<td>Mayers</td>
<td>300$</td>
</tr>
<tr>
<td>Alex</td>
<td>Jonson</td>
<td>400$</td>
</tr>
</table>
th {
text-align: left;
}
table {
width: 400px;
}
: