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

  • Home
  • SEARCH
  • 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 731619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:02:51+00:00 2026-05-14T07:02:51+00:00

I have two div elements that are twins (i.e. their dimensions and contents are

  • 0

I have two div elements that are twins (i.e. their dimensions and contents are identical). I want to move of those div-s over another, so that their corners are at exactly the same coordinates. What I try to do is:

var offset = $('div#placeholder').offset();
$('div#overlay').css('position', 'absolute').css('left', offset.left + 'px').css('top', offset.top + 'px')

— but this causes the overlay to be exactly (or almost exactly, taking subpixel accuracy into account) 16px below the placeholder (below, i.e. overlay_top = placeholder_top + 16px).

I’m aware that offset() gives position relative to the document, and position: absolute sets position relative to body element, but compensating for body offset() doesn’t help much (I’m getting 8px offset, equal to margins):

offset.top -= $('body').offset().top;
offset.left -= $('body').offset().left;

Also, compensating for body margins (in case they were different that offset() didn’t help, as they were set to 8px).

Does somebody know what I’m doing wrong here?

UPDATE: Take a look at here – I’m getting the same result in FireFox 3.6.3 and Opera 10.10.

  • 1 1 Answer
  • 1 View
  • 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-14T07:02:52+00:00Added an answer on May 14, 2026 at 7:02 am

    I’m suspicious that you have some CSS rule being applied based on a class/name/element type in the stylesheet. I suggest that you try setting margin/padding on the element to 0 via javascript. You might also want to use WebDeveloper or FireBug and inspect the computed styles on the element after repositioning to see what styles are being applied and from where.

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

Sidebar

Related Questions

I have a formset that have two forms. forms: class PresClinicForm(forms.Form): _names = list(PresClinic.objects.values_list('pres_clinic_id',
I have a div 30px high and 500px wide. This div can contain two
I have two divs. One of them contains an input field the other a
I'm facing one of the craziest problems I've ever found in css... I have
I am trying to implement a forgotten password solution in rails. I have a
I am trying to place two divs next to each-other on the same line,
I am making a webpage, where there are two forms (users and owners), where
I had a look at some other questions but I'm still not sure how
I'm trying to create a website with a background-size:100% 100% css rule. It's an
This is my lame first attempt. I would like to get a count of

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.