PHP CSS random background
Results 1 to 2 of 2

Thread: PHP CSS random background

  1. #1
    Senior Member cluelessPHP's Avatar
    Join Date
    Apr 2015
    Location
    Scotland
    Posts
    460

    PHP CSS random background

    PHP Code:
    <?php
        $image 
    = ['image path''image path''image path'];
      
    ?>
    HTML Code:
    html
    		{ 
    			background: url(<?php echo   $backgroundImage = $image[mt_rand(0, count($image) - 1)]; ?>) no-repeat center center fixed; 
    			-webkit-background-size: cover;
    			-moz-background-size: cover;
    			-o-background-size: cover;
    			background-size: cover;
    			overflow-x: hidden;
    		}
    Generate random images with php and css
    Once you had a good excuse, you opened the door to bad excuses ― Terry Pratchett, Thud
    Fresh start
    Current date 14/10/17
    Finish date "should be" 14/04/18

    Vote on your preferred indentation method

  2. #2
    Junior Member
    Join Date
    Nov 2016
    Posts
    2
    thanks for share it is good

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •