Are there alternative methods to align text in HTML tables using CSS in PHP?

To align text in HTML tables using CSS in PHP, you can use the "text-align" property in your CSS styles. This property allows you to align text within table cells to the desired position, such as left, center, or right.

<!DOCTYPE html>
<html>
<head>
<style>
table {
  width: 100%;
}

th, td {
  text-align: center;
  padding: 8px;
}

</style>
</head>
<body>

<table>
  <tr>
    <th>Header 1</th>
    <th>Header 2</th>
    <th>Header 3</th>
  </tr>
  <tr>
    <td>Row 1, Cell 1</td>
    <td>Row 1, Cell 2</td>
    <td>Row 1, Cell 3</td>
  </tr>
  <tr>
    <td>Row 2, Cell 1</td>
    <td>Row 2, Cell 2</td>
    <td>Row 2, Cell 3</td>
  </tr>
</table>

</body>
</html>