Home › Forums › Design › Load random CSS on page load › Reply To: Load random CSS on page load
November 10, 2016 at 6:24 am
#247718
Participant
Similarly, with the PHP mt_rand() suggestion, theres nothing to figure out. Its just picking a random number between 1 and 5 (inclusively).
The line of code has been tested and works so it just needs to be pasted into the <head>
section of a web page – preferable a .php web page, although it will work in .htm/.html pages too if the server has been setup to parse PHP in those page extensions. More advice on doing that here http://deano.me/2015/12/php-inside-html-files-using-htaccess/
<link rel="stylesheet" href="/path/to/styles/<?php echo(mt_rand(1,5));?>.css" />