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 8601569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T01:52:28+00:00 2026-06-12T01:52:28+00:00

I have a small DIV with text-align:center . All it’s contents must be centered.

  • 0

I have a small DIV with text-align:center. All it’s contents must be centered. In this DIV I have a PHP code that generates a certain number of A HREF links with display:block. I want all these links to stand next to one another (till it’s too wide for the div, then the need to jump to the next line) so I use float:left. However, if only two links (blocks) show up, they are aligned left in my DIV, instead of in the middle. So I want my links to show up next to each other, but I also want to center them inside my DIV. How do I do this?

CODE per request:

<div style="margin-left:200px;width:300px;text-align:center;background-color:">Pagina's:<br clear="left"> 


<?php 
$sql = "SELECT COUNT(bedrijfsnaam) FROM profiles where plaats = '".$plaats2."'"; 
$rs_result = mysql_query($sql); 
$row = mysql_fetch_row($rs_result); 
$total_records = $row[0]; 
$total_pages = ceil($total_records / 1); 

for ($i=1; $i<=$total_pages; $i++) { 
            echo "<a style=\"float:left;display:block;color:white;width:22px;text-align:center;text-decoration:none;font-size:20px;background-color:#483435;margin-left:4px\" href='".$plaatsnaam7.".php?page=".$i."'>".$i."</a> "; 

}; 
?>


</div>
  • 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-12T01:52:29+00:00Added an answer on June 12, 2026 at 1:52 am

    parent div must have

    text-align: center
    

    everything inside must have display: inline; float: none;

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

Sidebar

Related Questions

I have a well div, and I would like to attach a small text/image
I have a small section of php in one of my pages that isn't
I have anchors that are separated by &nbsp;|&nbsp; . This is all wrapped in
I have a two-column layout. I have a #mainContainer div that contains all of
I have a line of text that I'm wanting to position a small graphic
I have small web app that generate PDF files as a report. I'm trying
I have the following html code: <div class=outer ui-draggable style=position: relative;> <div class=inner>Foo bar</div>
I have this HTML with a table: <div class=currentDesignDiv style=margin-bottom:5px;> <div> <img alt=Thumbnail src=http://www.propertyware.com/templates/
I am trying to create some div (that should be buttons) that have rounded
Purpose is to have a small icon on my admin page. Clicking this icon

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.