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

  • Home
  • SEARCH
  • 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 9249379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:10:25+00:00 2026-06-18T10:10:25+00:00

I currently have a pagination module that can’t be done in a ul/li. it’s

  • 0

I currently have a pagination module that can’t be done in a ul/li. it’s just a surrounding div w/ a bunch of anchors inside.

<div class="pagination">
    <a href="#">1</a>
    <a href="#">2</a>
    <a href="#">3</a>
    <a href="#">4</a>
</div>

Each has padding to make the width/height since the numbers can go from single digit to triple digit (1-1##). I need to center the pagination, but without a width I can’t do it. The width is always changing depending on the numbers in the pagination. How can I apply the width of all the to the containing w/ class ‘pagination’?

var pagWidth = $('.pagination').width();
$('.pagination').css('width',pagWidth);

I know this is incorrect, as it will apply the width of the which will calculate 100% of whatever width the div is in. Please assist.

  • 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-18T10:10:26+00:00Added an answer on June 18, 2026 at 10:10 am

    You can do this with css. To centre your div use the following :

    .pagination
    {
       margin:0px auto;
    }
    

    or use it’s equivalent in javascript.

    To calculate the width of all the children.

    var totalWidth = 0;
    
    $("div.pagination").children().each(function() {
       totalWidth = totalWidth + $(this).width();
    });
    
    $('.pagination').css('width',totalWidth);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have created a pagination JavaScript class that will automatically paginate comments when
I currently have pagination functionality that displays the total page count, but I was
I currently have a report with pagination, that displays 20 records at a time.
I have a div selector script with icons as pagination that I'm working on.
Currently have a drop down menu that is activated on a hover (from display:none
I currently have a XSLT 2.0 Stylesheet that I am trying to remove empty
I currently have one project that currently contains multiple packages. These packages make up
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies
I currently have a listing of data that has a randomly generated order listing.
I have am currently using Dojo EnhancedGrid with Pagination, filtering and cell edition. The

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.