CSS TABLE ALIGMNMENT

If you mean CSS table alignment, here are the main properties:

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border: 1px solid black;
  padding: 10px;
  text-align: center;       /* horizontal alignment */
  vertical-align: middle;  /* vertical alignment */
}

Common alignment options

Horizontal:

text-align: left;
text-align: center;
text-align: right;

Vertical:

vertical-align: top;
vertical-align: middle;
vertical-align: bottom;

Align only specific columns

td:first-child {
  text-align: left;
}

td:nth-child(2) {
  text-align: center;
}

td:last-child {
  text-align: right;
}

Example:

<table>
  <tr>
    <th>Name</th>
    <th>Age</th>
    <th>Salary</th>
  </tr>
  <tr>
    <td>Ali</td>
    <td>25</td>
    <td>$500</td>
  </tr>
</table>

If you show me your HTML + CSS table code, I can fix the alignment directly.

Comments