php - Multicolored divs -


my site search engine returns many many results foreach loop such:

foreach ($xml->channel->item $result) {     $ltitle = $result->title;     $ldesc = $result->description;     $url = $result->displayurl;     $link = $result->link;      if (strlen($ltitle) > 60)     { $title = substr($ltitle,0,60).'...' ;     }     else     {     $title = $ltitle;     }  if (strlen($ldesc) > 195)     { $desc = substr($ldesc,0,195).'...' ;     }     else     {     $desc = $ldesc;     }       echo "  <br>   <div class='resultbox'>  <a class='normal' style='text-decoration:none;font-size:huge;font-weight:bold' href='$link'>$title</a><br> <div style='padding-top:3px;padding-bottom:4px;width:580px;'> <font style='text-decoration:none;font-size:small;font-family:arial;'>$desc<br></font></div> <a style='text-decoration:none;' href='$link'><font style='text-decoration:none;font-size:small;color:green;font-weight:bold;'>$url<br></font></a>  </div> "; } 

and resultbox class above styles of results

.resultbox { height:auto; width:600px; background-color:transparent; font-size:19px; padding:10px; padding-left: 30px; padding-right: 30px; border-left: 6px solid #333; } .resultbox:hover { border-left: 8px solid #555; } 

the border-left color want changed, generate or style randomly off of list of colour codes results, insead of being #333 can #333 #555 #999 , on..... ideas?

change <div class='resultbox'> <div class='resultbox random-color-".rand(1,your_color_limit)."'> , define colors like

.random-color-1 {      border-left: 8px solid #555; } .random-color-2 {      border-left: 8px solid #555; } ..... .random-color-your_color_limit {      border-left: 8px solid #555; } 

Comments