Pagination works fine but the numbers are sorted vertically. I need them horizontal.

Viewed 145

I finally got my pagination to work, but now the numbers are showing up vertically aligned. Is something from my code causing this? If this code doesn't give enough information, please let me know and I'll post the full code.

foreach (getPageList($number_of_pages, $whatIWant, 12) as $i)
{
    if ($i == $whatIWant)
    {
        $pagination .= '<li class="active"><a href="?page='.$page. $i . 
                     '"ng-click="progress()" class="goToTop">' . 
                     $i . '</a></li>';
    }
    else if ($i == 0)
    {
        $pagination .= '<li>&hellip;</li>';
    }
    else
    {
         $pagination .= '<li class="active"><a href="?page='.$page. $i . 
                     '"ng-click="progress()" class="goToTop">' . 
                     $i . '</a></li>';
    }
}       
echo $pagination;

1 Answers

You are printing your pagination numbers in <li>, that will make a list. Remove the list and it will show you the expected behavior.

Demo:

<li class="active"><a href="?page=1" ng-click="progress()" class="goToTop"> 1 </a></li>
<li class="active"><a href="?page=2" ng-click="progress()" class="goToTop"> 2 </a></li>

<p>If you remove list tag: </p>
<a href="?page=1" ng-click="progress()" class="goToTop"> 1 </a> &nbsp;
<a href="?page=2" ng-click="progress()" class="goToTop"> 2 </a>

Related