How can the width of a table be fixed to prevent it from collapsing when the browser is resized in PHP?
To prevent a table from collapsing when the browser is resized, you can set a fixed width for the table using CSS. This will ensure that the table maintains its size regardless of the browser window size. You can achieve this by adding a style attribute to the table tag or by using an external CSS file.
echo '<table style="width: 100%;">';
echo '<tr>';
echo '<td>Cell 1</td>';
echo '<td>Cell 2</td>';
echo '</tr>';
echo '</table>';
Keywords
Related Questions
- What is the purpose of the shownode function in the PHP code provided?
- How can the user bypass the security measures implemented to prevent script execution on page reload in PHP?
- What are the advantages of using PHP and SQL for website development, particularly in terms of speed and dynamic content integration?