How can CSS be utilized to solve layout problems in PHP output?

When dealing with layout problems in PHP output, CSS can be utilized to style and position elements on the webpage. By using CSS, you can control the layout, alignment, and appearance of the PHP-generated content. This allows for a more visually appealing and user-friendly presentation of the data.

<?php
echo "<div style='width: 50%; margin: 0 auto; padding: 10px; background-color: #f2f2f2;'>";
echo "<h2>Welcome to our website!</h2>";
echo "<p>This is some PHP-generated content that is styled using CSS.</p>";
echo "</div>";
?>