How can CSS be used to manipulate the appearance of data displayed in a table generated by PHP?
To manipulate the appearance of data displayed in a table generated by PHP, CSS can be used to style the table elements such as borders, background colors, text alignment, and font styles. By adding CSS styles to the table elements, you can customize the look and feel of the table to better suit your design preferences.
<?php
echo "<table style='border: 1px solid black;'>";
echo "<tr><th>Name</th><th>Age</th></tr>";
echo "<tr><td style='background-color: lightblue;'>John</td><td style='text-align: center;'>25</td></tr>";
echo "<tr><td style='background-color: lightgreen;'>Jane</td><td style='text-align: center;'>30</td></tr>";
echo "</table>";
?>
Keywords
Related Questions
- How can PHP be utilized to retrieve user data from a database after successful authentication for features like a shoutbox?
- How can the issue of "failed to open stream: No such file or directory" be resolved when including files in PHP?
- How can the code be optimized to improve performance when searching in both .txt and .html files?