mardi 24 mars 2015

Random CSS class/id name using PHP

I am generating random ID's for 2 divs, and I would like to use those randomly generated names in CSS too, as now I have to use inline styles.


Also, I don't want to use separate PHP file with CSS header to use that. Is there some other way to do it?


Lets say I want to have that padding set to randomly generated ID $id_1 in CSS and not as inline.



$id_1 = generate_function(rand(5,10));
$id_2 = generate_function(rand(5,10));

echo "<div id='".$id_1."' style='padding:20px 10px 0px 10px'>";


Thank you.





Aucun commentaire:

Enregistrer un commentaire