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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:18:59+00:00 2026-06-13T07:18:59+00:00

I am trying to position some divs inside another container, When I set position:

  • 0

I am trying to position some divs inside another container,
When I set position: relative; on those divs they are drawn inside the container but when I add the top and left style properties, they aren’t drawn correctly

here is my code:

<table style="background:black;width:80%;height:90%;">
    <tr>
        <td style="background:yellow;width:15%">Left Pane</td>
        <td style="background:black;width:85%">
            <div id="a" style="background:green;position:relative;top:1px;left:80px;width:20%;height:20%">a</div>
            <div id="b" style="background:blue;position:relative;top:10px;left:14px;width:20%;height:20%">b</div>
            <div id="c" style="background:red;position:relative;top:10px;left:14px;width:20%;height:20%">c</div>
        </td>
    </tr>
</table>

as you can see divs #b & #c should be placed on each other because of their top & left properties but they are drawn beneath each other,
If I set position: absolute; they are placed on each other, but they aren’t positioned according to their container but according to the screen.

Is there any way to position the divs on top of each other according to their container?

  • 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-13T07:19:01+00:00Added an answer on June 13, 2026 at 7:19 am

    learn about position relative and absolute:

    css tricks: position relative and absolute

    in short:

    the container elements gets position: relative;

    the elements inside it, get position: absolute; and values for top/bottom/left/right

    this allows you to control positioning and it is cross-browser compatible (old versions of IE handle positioning in a terrible way!)

    PS a couple of generic suggestions to improve your coding skills:

    • try to avoid using tables for layout.

    • use an external css file rather than inline – it’s easier to mantain on the long run and reusable.

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

Sidebar

Related Questions

I'm trying to position some divs children of the same parent, giving offset top
I'm trying dynamically to add some DIVS ( with dynamically added function ) to
trying to learn some html/css and I'm having a problem with fixed position divs.
I'm trying to position div as a footer inside parent div. <div> ...some content...
I'm trying to position a DIV inside another DIV on its' bottom part. When
I'm trying to find the correct placement of images inside a container relative to
I'm trying to absolutely position some floated divs using this code: $(function() { $('#wrapper
I'm running into some positioning inconsistencies between browsers. I'm trying to position a submit
I'm trying to position a div inside a div. the outer div has a
I'm trying to create some divs, with user input values like amount and size.

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.