$i=0; while($i<count($news)){ if ($i++%3==0) { echo "<br />";//переход на другую строчку } echo "<article>"; echo '<div id="img_div"> <img src="/images/'.$news[$i]["image"].'" > <p>'.$news[$i]['intro_text'].'</p> </div>'; echo "</article>"; } with the help of a cycle, we draw 3 articles in a row, and then we make 3 articles on the next row, and so on ... how to make this transition? I think that with the help of if, but I even stupid and do not know what to write inside .. help, thanks in advance