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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T00:23:05+00:00 2026-05-20T00:23:05+00:00

I have two divs, one inner and one outer, but the inner div is

  • 0

I have two divs, one inner and one outer, but the inner div is being rendered below the outer div. Here’s my simplified markup:

<div id="outer" style="position: relative;">
    Outer

    <div id="inner" style="position: absolute; right: 0;">
        Inner
    </div>

</div>

I can confirm in Firebug that the inner div is rendered below (and outside of the outer div). Obviously I’m assuming that there is some other style on the page that could cause this, but I haven’t been able to find it. What could cause this kind of behavior? Interestingly, when I remove the position: absolute; style from the inner div, this behavior disappears… but of course I don’t get the positioning I want in that case.

What I want here is the inner div to appear below the text “Outer,” but still inside the outer div. I’d like to to be aligned to the right side of #outer.

There’s also another div inside #outer, where the text “Outer”, aligned to the left (position: absolute; left: 0;). I didn’t mention that in the original question because it didn’t seem directly relevant to the behavior I’m observing. Both inner divs with absolute positioning show up below and outside of #outer.

Edit: What I really, really want here is an outer container with two inner columns: one on the left and one on the right. Floats seem to cause other problems, so I was hoping that relative+absolute positioning would solve this.

  • 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-20T00:23:05+00:00Added an answer on May 20, 2026 at 12:23 am

    Your problem is not with the absolute position. Indeed inner div will have top,left of outer div as root coordinates, the problem is laying down in how divs (block elements) are rendered when no width/height attributes are set, check this below it will answer your question. 🙂

    <div id="outer" style="position: relative; background-color: #f1af1f; width: 100px;">
        Outer
        <div id="inner" style="position: absolute; top: 0; right: 0;">
            Inner
        </div>
    </div>
    

    Edit:
    I updated the code above, you can run it in your browser and you’ll see the follow (I will try to explain how the browser understands it).
    A yellow rectangle with text “Outer” on left and “Inner” on right on the same line. The rectangle is 100px width. Now how the browser understands the code above.

    First the browser parses the html into DOM Tree, so you can this structure (simplified)
    body ->
      div#outer -> // position relative, yellow background, 100px in width, auto-height
        div#inner -> // position absolute, top offset 0 units, right offset 0 units.
    

    Now the browser renders div#outer at top left corner of the browser’s window, with the width of 100px, auto calculates the height based on the font used to display the string “Outer”. Then it moves to its children (div#inner). It sees its positioned absolute with top and right. Now the browser knows div#outer is positioned relatively so it sets (top,left) coordinates of div#inner to start from (top,left) coordinates of div#outer. Once this is measured, the browser knows how to set top and right. In our case the bounds of div#outer are (top, left, right, bottom): 0, 0, 100, X (depending on div#outer content height). So div#inner position start from div#outer top border to the bottom and from its right border to the left one (depending on the content).

    Now, one this to mention here. If you have more content in your div#inner then the height/width of your div#outer the inner one will overlap and go out the boundaries of div#outer. You can fix this by adding: overflow: hidden; to div#outer.

    Hope this makes the thing more clear.

    Note: I skipped details on how position absolute is handled by the browser.

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

Sidebar

Related Questions

I have a div with two nested divs inside, the (float:left) one is the
I have a div which contains two nested divs, one that specifies a height
I have a container div that holds two internal divs; both should take 100%
I have two divs (one inside of the other) and am running into a
I have two sibling divs sitting below each other, both contained in the same
I have two divs one above the other. The second on is absolutely positioned
I have two divs inside a div, I want them both adjacent to each
I have two images that I want adjacent but they appear one above the
I have two divs and two separate links that triggers slideDown and slideUp for
I have two classes, and want to include a static instance of one class

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.