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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:27:18+00:00 2026-05-28T18:27:18+00:00

I have two images next to each other in HTML. One image is taller

  • 0

I have two images next to each other in HTML. One image is taller than the other. Images have a vertical-align: middle CSS property. This causes the shorter image to be positioned lower, relative to the parent container, than the taller image.

I use the jQuery .position() method to get the images’ position. The position.top for both images is the same, when clearly the shorter image is offset further towards the bottom because of the vertical-align: middle CSS property.

How can I get the image’s actual position, taking into consideration the vertical difference caused by the vertical-align: middle CSS property?

UPDATE:

The problem happens because I do the following:

  1. My HTML is output with the images having no src attributes. They do
    have a width and height, so the browser should not need to wait to
    load the actual image (later step) before calculating its position
  2. I set the src attribute of each image
  3. I check the position using jQuery. My guess is that the browser (FF
    9.0.1) waits to load the image before updating its position and making it available to JS

I will need to redesign my app so that this does not happen

  • 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-05-28T18:27:19+00:00Added an answer on May 28, 2026 at 6:27 pm

    Try this.

    http://jsfiddle.net/cadence96/X54gy/

    small = parseInt($('img:eq(0)').css('height'));
    big = parseInt($('img:eq(1)').css('height'));
    
    difference = big - small;
    top_distance = difference/2;
    
    alert(top_distance);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two divs next to each other, one with float: right and the
I have two floating divs next to each other, and want the left one
I have two images in the background of my html doc. One positioned top
I have two images positioned of the top of each other. When I click
I am custom drawing two zoom-in images on the screen, one next to each
I have two div's and I want to show them next to each other.
Say I have two divs next to each other (take https://chrome.google.com/webstore/category/home as reference) with
i am new to opencv and i have loaded two chessboard(http://kvisit.com/amaAY)images one next to
I have two divs displayed next to each other, left div is 20% width
I have two images on a WPF window that are on top of each

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.