- PHP

How to change the Background Color in PHP

Add CSS code with background color with PHP echo.

Change the website background with PHP

<?php

echo '<style>
body {
    background: red;
}
</style>';

?>

Change the element background with PHP

<div class="myElement">Hello</div>

<?php

echo '<style>
.myElement {
    background: #eee;
}
</style>';

?>

Output:

Hello