How To Create A Random Background Color Using Php
The following Script shows You how To Generate a "Random Background color". A random background color can be created with an "Array Function", and a little bit of CSS...
<?php
$colors = array ("red","green","cyan","blue","lightblue","brown","purple");
?>
<!DOCTYPE html>
<html>
<head land="en">
<title>HELLO WORLD</title>
</head>
<style>
body{
background-color:<?php echo $colors[rand(0,count($colors)-1)]?>;
}
.area{
width: 1000px;
height:3000px;
background-color:<?php echo $colors[rand(0,count($colors)-1)]?>;
margin-left:0;
}
</style>
<body>
<div class="area"></div>
</body>
</html>
Trying this makes it easier for you to create a "Random Background color".
No comments:
Post a Comment