Mohsin Sharif Mohsin Sharif - 1 month ago 4
CSS Question

how to create space between anchor tag elements in loop in paging

I'm creating a paging option in my website. The problem is that the paging digits is not align in the appropriate way in fact the images is attached. [This is my image in which number not align correctly

This is output of my paging numbers:

This is output of my paging numbers

This is my code.

<div class="container" style="padding-bottom:10px; font-size:20px;">
<?php $sql1 = "SELECT * FROM videos ";
$query = $conn->query($sql1);
// Return the number of rows in result set
$rowcount = $query->rowCount();
$a= ceil($a);
for($b=1; $b<=$a; $b++)
?> <a style=" " href="index.php?page=<?php echo $b; ?>"><?php echo $b. " " ?> </a> <?php

But I want to align these numbering in this way:

This image exactly shows requirement of my result:

This image exactly shows requirement of my result

please anyone can help me. how to fix it. thanks


you should use a table as grid

Try this

    $numbers_per_row = 5;
    $rowi= 0; 
    $numbers_limit = 25;
    for($b=1; $b<=$numbers_limit ; $b++)
    echo '<td><a href="index.php?page='.$b.'">'.$b.'</td>';
      if($rowi<=$numbers_per_row) {
      else { echo  '</tr><tr style="margin-top:10px;">'; 
                               /* <-- change it ^ to what you want */
      /* Reset counter */ 
      $rowi = 0; }