ridiculous Posted November 28, 2006 Share Posted November 28, 2006 I really like the technique this kid used on his site: http://www.c71123.com/daily_photo/and I'm trying to discern the best way to mimic the seemingly random-color div's on his page. Any suggestions? You can do it!!!!! Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/ Share on other sites More sharing options...
corbin Posted November 28, 2006 Share Posted November 28, 2006 Use a style sheet and then make the div names dynamic and make them 1 2 3 or something so you could keep track of them with an auto incremented value or something... Then make them random or go 12345... Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/#findComment-131846 Share on other sites More sharing options...
ridiculous Posted November 28, 2006 Author Share Posted November 28, 2006 [quote author=corbin link=topic=116642.msg475377#msg475377 date=1164755056]Use a style sheet and then make the div names dynamic and make them 1 2 3 or something so you could keep track of them with an auto incremented value or something... Then make them random or go 12345...[/quote]What do you mean by "make them 1 2 3 or something so you could keep track of them with an auto incremented value or something... Then make them random or go 12345..."? Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/#findComment-131860 Share on other sites More sharing options...
sw0o0sh Posted November 29, 2006 Share Posted November 29, 2006 Uhm, assuming your using php, assign different style sheets to a random value.[code]<?PHP$rand=rand(1,3);if($rand==1){ echo "<link rel='stylesheet' href='blabla/mystyle1.css' type='text/css' />";}else if($rand==2){ echo "<link rel='stylesheet' href='blabla/mystyle2.css' type='text/css' />";}else{ echo "<link rel='stylesheet' href='blabla/mystyle3.css' type='text/css' />";}?>[/code] Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/#findComment-131891 Share on other sites More sharing options...
corbin Posted November 29, 2006 Share Posted November 29, 2006 I meant do something like <div class="divcolor_<?=rand(1,10);?>">Then in a style sheet set the colors and what not for divcolor_1, divcolor_2 so on... Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/#findComment-131896 Share on other sites More sharing options...
sw0o0sh Posted November 29, 2006 Share Posted November 29, 2006 Alrighty.. Maybe you'd write...[code]<?PHP$rand=rand(1,10);echo "<div class='divcolor_".$rand."'>";?>or<?PHP$rand=rand(1,10);?><div class='divcolor_<?PHP echo $rand; ?>'>[/code] Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/#findComment-131899 Share on other sites More sharing options...
corbin Posted November 29, 2006 Share Posted November 29, 2006 That would work :P If you wished to have random themes though a diff style sheet would be a better approach. Link to comment https://forums.phpfreaks.com/topic/28796-randomizing-text-background-colors-so-hot-5mins-ago/#findComment-131905 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.