css - php set top property different after every 3 div dynamically -
i want set css top property different after every 3 div's
for eg:
<div style="top:100px;"> </div> <div style="top:100px;"> </div> <div style="top:100px;"> </div> **now after next 3 div's shall have** <div style="top:150px;"> </div> <div style="top:150px;"> </div> <div style="top:150px;"> </div> **now after next 3 div's shall have** <div style="top:200px;"> </div> <div style="top:200px;"> </div> <div style="top:200px;"> </div> **and on**
i want dynamically using php. using loop can check if
$ij=0; if($ij%3==0) { echo ""; } else { }
but not sure how desired result.
any appreciated.
try this:
$top = 50; $n = 30; // no. of divs for($i = 0; $i < $n; $i++) { if($i % 3==0) $top+=50; echo "<div style=\"top:".$top."px;\">\n</div>"; }
Comments
Post a Comment