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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:35:08+00:00 2026-06-02T19:35:08+00:00

My page has space for an image that can be, say, a maximum 100×100

  • 0

My page has space for an image that can be, say, a maximum 100×100 image. Users can upload any image dimension and the web application will resize it, maintaining aspect ration, to 100×100. So, it’s possible for images to be resized to, say, 75×100 or 100×75, etc.

Regardless of the resized image’s dimension, I want it to appear vertically and horizontally centered in its allocated space on the web page. How do I do this in CSS? Will I need a containing div, like this:

<div class="image_container">
     <image src="http://placehold.it/100x100/" height="100" width="100" alt=""/>
</div>

Anyway, sample CSS would be helpful. Thanks!

  • 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-02T19:35:09+00:00Added an answer on June 2, 2026 at 7:35 pm

    Try this – http://jsfiddle.net/zYx4g/
    This will work on image of any size and in all browsers.

    .image_container {
        width: 300px;
        height: 300px;
        background: #eee;
        text-align: center;
        line-height: 300px;
    }
    
    .image_container img {
        vertical-align: middle;
    }
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Page has menu items that would replace a 'div id=foo_(current menu item)' with 'div
My page has 3 divs that are located horizontally. I need to make the
Say a web page has a string such as I am a simple string
On my website, users can upload large images. I display these images like this:
my page has 2 jqgrids 1) jQuery(#gridmain).jqGrid({.... 2) jQuery(#gridsub).jqGrid({.... I read that to make
I have a page that has a header, content, and footer. The header and
My page has a form on it that interacts with a CFC via an
I'm new to jQuery and having some trouble. A have a page that has
I have a fairly simple page that displays an image in a pop-up window.
I have a web page that has an HTML table generated by an ASP.NET

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.