Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8741585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:20:33+00:00 2026-06-13T11:20:33+00:00

I am having a bit of trouble with trying to wrap an HTML Div

  • 0

I am having a bit of trouble with trying to wrap an HTML Div around a section of php that creates pagination links.

I am wrapping the div around the code, yet for some reason the div is appearing before (outside) the pagination links. As you can see all the CSS is doing at the moment is putting a border around the div.

I can’t figure out what I am missing. Any pointers would be much appreciated. Thank you in advance.

PHP/HTML

echo '<div class = "pagination">';

/******  build the pagination links ******/
// range of num links to show
$range = 3;

// if not on page 1, don't show back links

  if ($currentpage > 1) {
   // show << link to go back to page 1
   echo " <a  href='{$_SERVER['PHP_SELF']}?currentpage=1'><div class = 'pagination_button'> << </div></a> ";
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back to 1 page
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><div class = 'pagination_button'> < </div></a> ";
   }

// loop to show links to range of pages around current page
for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) {
   // if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo " <div class = 'pagination_button_current'><b>$x</b></div> ";
      // if not current page...
      } else {
         // make it a link
         echo " <a  href='{$_SERVER['PHP_SELF']}?currentpage=$x'><div div class = 'pagination_button'>$x</div></a> ";
      } // end else
   } // end if 
} // end for

   if ($currentpage != $totalpages) {
   // get next page
   $nextpage = $currentpage + 1;
    // echo forward link for next page 
   echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'><div div class = 'pagination_button'> > </div></a> ";
   // echo forward link for lastpage
   echo " <a  href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'><div div class = 'pagination_button'> >> </div></a> ";
   }
/****** end build pagination links ******/


?>

</div> <!-- End pagination div -->   

CSS

.pagination {
    border:1px solid;
 }  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:20:34+00:00Added an answer on June 13, 2026 at 11:20 am

    You have some errors in the syntax for HTML

    Don’t write << or <, better &lt;&lt;

    Even don’t use >> or >, better &gt;&gt;

    Also there are some strange notations like <div div class = 'pagination_button'>, it should be <div class = 'pagination_button'>

    At least, just for validity: Don’t use <div> inside of <a>

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having a bit of trouble wrapping my head around this one. I'm sure the
I'm having a bit of trouble trying to delete rows that haven't been loaded
I'm having a bit of trouble right now trying to implement word wrapping for
I'm having a bit of trouble using variable generated php div classes and jQuery
I'm having a bit of trouble trying to understand how WARP could potentially interact
I'm having a bit of a trouble trying to figure this out today, i
I'm trying to learn Razor/MVC3 and having a bit of trouble with this partial
I am having a little bit of trouble... I am trying to get a
I'm having a bit of trouble loading an html file in a WebView control
I'm having a bit of trouble with a a function that the mongodb c

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.