Home > Article > Backend Development > Can css be written in php?
Can I write css in php?
css can be written in php. In PHP, HTML, CSS and JavaScript codes are treated as strings and then parsed in the browser.
Introduce css styles into PHP scripts. The code example is as follows:
<?php header("content-type:text/html;charset=utf-8"); echo '<p style="color:red;">Hello!</p>'; ?>
Output:
You can also introduce external CSS files.
<?php echo '<link rel=\"stylesheet\" type=\"text/css\" href=\"theme.css\" />'; ?>
For more PHP related knowledge, please visit PHP Chinese website!
The above is the detailed content of Can css be written in php?. For more information, please follow other related articles on the PHP Chinese website!