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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T10:19:00+00:00 2026-06-16T10:19:00+00:00

The following html and css format arranges my images so that there are nine

  • 0

The following html and css format arranges my images so that there are nine on each row through floating. There is, however, a large gap at the end of the each row (but presumably not large enough to fit another image, and thus the new row starts):

HTML:

<div id = "body">

<div class="img">
  <a href="">
  <img src="" width="110" height="90">
  </a>
  <div class="desc"></div>
</div>

<div class="img">
  <a href="">
  <img src="" width="110" height="90">
  </a>
  <div class="desc"></div>
</div>
</div>

//This is repeated many times so that there are 4 rows of nine images

CSS:

div.img
  {
  margin:2px;
  border: 2px solid #000000;
  height:auto;
  width:auto;
  float:left;
  text-align:center;
  }
div.img img
  {
  display:inline;
  margin:8px;
  }

div.desc
  {
  text-align:center;
  font-weight:normal;
  width:120px;
  margin:5px;
  }

My first question is how do i “shift” the first image of each row so that gallery is symmetrical in the screen. My second question concerns how to ensure this formation (9×4) is the same in every browser ( on every screen width)?

At present i have been using a fixed container (in terms of pixels) to fill my own screen. Many thanks in advance.

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

    Instead of using float: left, use display: inline-block on the container divs. This allows you to center the images:

    #body {
      text-align: center;            
    }
    div.img
    {
      display: inline-block;
      ....
    }
    

    http://jsfiddle.net/xzH7R/1/

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

Sidebar

Related Questions

I want a format html using CSS so that I get the following: Image
I have the following html/css that is causing problems in Firefox 1.5 and 2,
i have the following jquery code to format a html table. $(.jtable td).each(function() {
I am following a tutorial http://css-tricks.com/sending-nice-html-email-with-php/ to send mail in html format. My string
Consider the following HTML/css code sample: <div id="container"> <div id="up">Text<br />Text<br />Text<br /></div> <div
I have the following html/css code . When I have the screen resolution to
The following html and css shows two divs inside a container. The left div
I have the following html and css code: <!DOCTYPE HTML> <html> <head> </head> <body>
I have the following HTML and CSS in a jsfiddle : <div class=MyBox> <div
I have the following html and css. But what I can't figure out is

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.