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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:44:57+00:00 2026-06-10T11:44:57+00:00

I have a div with image image.jpg. By using text-align=center , the image is

  • 0

I have a div with image “image.jpg”.

By using text-align=center, the image is being centered horizontally.

However it’s not vertically aligned. How would I implement the vertical alignment?

<div style="vertical-align: middle;text-align:center;">
    <img title="Title3" src="image.jpg" style="display: inline;" id="idImage">
</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-10T11:44:59+00:00Added an answer on June 10, 2026 at 11:44 am

    If you set the height of the parent container and set your margin-top: auto, it should align to the middle I think. This works with horizontally aligning, but I haven’t tried with vertical. Anyways, it would avoid absolute positioning

    As mentioned before, you can also use javascript to find the height, then set the margin, something like this:

    var image = document.getElementById("myImage");
    var imgHeight = image.style.height;
    image.style.marginTop = -(imgHeight/2);
    image.style.top = 50%; //you can probably just set this in css and omit this line
    

    you must of course set

    #myImage{
      position: absolute;
    }
    

    though

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

Sidebar

Related Questions

I have an image <div class='container'> <img src='../images.jpg' alt='images' /> </div> I want to
I always thought that replacing the <center> tag with <div style=text-align:center;> will get me
I have a div in the center of the page. I have the background-image
I have this image floated to the left of text working fine using the
I have an image div like this <div class=bgCover>&nbsp;</div> <div class=overlayBox style=position: fixed; background-image:
I have a DIV containing an image and a second DIV. The parent DIV
I have a div and an image inside it as a background: <div id=background>
i have a div that it have image content .i wanna implement animation when
i have many div's with the same background image and i want change this
I have a DIV element with a background image and I am trying to

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.