Set background color in PHP?

What is the easiest way to set the background color in PHP?

+3
source share
9 answers

just insert the following line and use whatever color you like

    echo "<body style='background-color:pink'>";
+5
source
<?php
    header('Content-Type: text/css');
?>

some selector {
    background-color: <?php echo $my_colour_that_has_been_checked_to_be_a_safe_value; ?>;
}
+3
source

CSS. PHP.

+2

CSS (.. "" = # 000000 "" = #ffffff) , , , - , PHP HTML , CSS .

, aa "" " ", , , , CSS.

, , , , PHP, , , , ( elseif , , ?

+1

php . ( "Content-type: text/css" ) style.php( )

0

, . , CSS Jay David Dorward.

PHP, GD . , GD. http://www.php.net/manual/en/function.imagecolorallocate.php

0

:

<style type="text/css">
  <?php include("bg-color.php") ?>
</style>

bg-color.php - :

<?php
//Don't forget to sanitize the input
$colour = $_GET["colour"];
?>
body {
    background-color: #<?php echo $colour ?>;
}
0

CSS , , CSS. , .

0

css, php id , .

0

Source: https://habr.com/ru/post/1758149/


All Articles