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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:47:11+00:00 2026-06-17T14:47:11+00:00

I have a container div and a button with following markup and css HTML:

  • 0

I have a container div and a button with following markup and css

HTML:

<div class="container">
  <table class="tbl">
    <tr><td></td></tr>
    <tr><td></td></tr>
  </table>
</div>

<button id="btnAdd" type="button">Add</button>

CSS:

.container{
  position:releative;
  background-color:#d0d0d0;
  widht:90%;
  height:50px;
}
.innerdiv
{
  position:absolute;
  z-index:1;
  background-color: #D57657;    
}
.tbl{
    border-collapse: collapse;
    width:100%;
    height:100%;
}
.tbl td
{
    border-bottom:1px solid #000;
}

I am using jQuery to dynamically add child divs to the container div

$(function(){
  $("#btnAdd").click(function(){
      $(".container").append("<div class='innerdiv'>I am new</div>");
  });
});

The problem is all the divs that I create by clicking button hide each other and I want these child divs to be displayed side by side. How can I accomplish this.
You may want to have a look at it as jsFiddle

Edit The initial issue was solved by removing position:absolute from .innerdiv once there are no elements in the container div. I have a table inside my container div and suggested solutions add the child divs below the table which I actually wanted to display over the `table’ rows.

  • 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-17T14:47:12+00:00Added an answer on June 17, 2026 at 2:47 pm

    Don’t use position: absolute for your divs, juse float them to the left and they will be side by side, otherwise you need to calculate position (top, left)

    float: left;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a container div with the following CSS: #container { position:relative; overflow:hidden; width:200px;
I have the following HTML: <div class=button accessLink id=loginLink data-href=/User/Account/Login title=Login>Login</div> What I need
I have the following input inside an asp.net repeater <div class=detailsItem> <input type=button class=saveCommand
I have some very simple HTML: <div id=advisor> <div id=print_this_container> <form> <input type=button value=
I have the following html <form action= class=form-horizontal id=submitForm> <input class=required input-xxlarge type=text placeholder=Please
I have the following html which displays 3 textboxes and an add button: <html
I have the following in my application layout page <body> <div class=container showgrid> <%=
I have the following HTML generated by Drupal <fieldset id=webform-component-lunchset class=webform-component-fieldset form-wrapper style=> <div
i have a container div which is position:relative and the squares are position:absolute because
I have a table which has a button to Add Rows. This button adds

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.