Skip to content
PHP Logo

How can CSS be utilized to format text output in PHP instead of using font tags?

To format text output in PHP using CSS instead of font tags, you can use inline CSS styles or define a separate CSS file and link it to your PHP file. This allows for better separation of content and presentation, making your code cleaner and more maintainable.

php
<?php
echo '<div style="font-family: Arial, sans-serif; font-size: 16px; color: #333;">Hello, World!</div>';
?>