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 enter image description here

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

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -