Home >Backend Development >PHP Tutorial >How to Correctly Include CSS Files in PHP
When attempting to include CSS files using PHP code, some users may encounter an issue where the CSS code is printed on the page instead of being applied as a stylesheet. This can occur when the CSS file is included without the necessary HTML syntax to define a style element.
To correctly include a CSS file using PHP, follow these steps:
<code class="php"><?php include 'header.php'; ?> <?php include 'CSS/main.css'; ?> ...</code>