The boss said:
I want a line of 5 items, each of which looks different.
<! DOCTYPE html>li{List-style:none;} . slide-content li{float: left;width:100px;height:100px;border:1px Solid#000;margin:5px;line-height:100px;color: #000; text-align:center;}. Li-1{background:Red;} . Li-2{background:Yellow;} . Li-3{background:Blue;} . Li-4{background:Green;} . Li-5{background:Gray;}</style>PHP//at least 5 of the product group .$items=Array( Array("Name" = "Product1", "Price" =>10),Array("Name" = "Product2", "Price" =>20),Array("Name" = "Product3", "Price" =>30),Array("Name" = "Product4", "Price" =>40),Array("Name" = "Product5", "Price" =>10));//a row shows 5 $li _n=5; //Baby Count $p _num=Count($items) +1; //number of UL cycles, CEI (1.5) =2 $ul _n=Ceil($p _num/$li _n); for($i= 1;$i<$ul _n;$i++){ $li _nav=1; Echo' <ul class= ' slide-content ' > '; foreach($items as $key=$item){ /*Listart*/ $s _n=$key+1; $end _q=$i*$li _n; $star _q=$end _q-$li _n; /*1-5,5-10,10-15 and so on, Li_nav every time starting from 1*/ if($s _n>$star _qand$s _n<=$end _q){ Echo' <li class= ' li-'.$li _nav.‘" > '.$item[' name ']. ' </li> '; $li _nav++; } /*Liend*/ } Echo' </ul> '; }?></body>PHP Exercise: one row per 5 items