php - how to show items in a row wise (i.e 5 items per rows) -
i have show tags onto view page controller. show 5 tags per row ,currently below code showing 1 tag per row. please me how this?
$query = $this->tagsmodel->fetch_all_tags($postnumbers, $offset); if (is_array($query)) { foreach ($query $row) { $content = substr(strip_tags($row->tags_name), 0, 180); echo '<div class="parent" id='.$row->tags_id.'>'; echo '<a class="tagsbtn" href="" >'.$content.'</a>'; echo '</div>'; } } currently getting output 
you can using css
.main { width : 400px; } .main .parent{ float : left; margin-right : 10px; } adjust width per 5 tags in row.
echo "<div class='main'>"; foreach ($query $row) { $content = substr(strip_tags($row->tags_name), 0, 180); echo '<div class="parent" id='.$row->tags_id.'>'; echo '<a class="tagsbtn" href="" >'.$content.'</a>'; echo '</div>'; } echo '</div>';
Comments
Post a Comment