user1184100
user1184100

Reputation: 6894

Div elements overlap each other - css

Here's is the code http://jsfiddle.net/DTYEB/14/ , the images there overlap each other i want them beside each other. I can change the position to relative in css class .container{} but functionality of the app changes so is there any way to have spacing between the elements

Upvotes: 1

Views: 4465

Answers (2)

Hardik Raval
Hardik Raval

Reputation: 1940

i have updated your script and add following code,

$(dragElement).css('position','relative');
$(dragElement).css('float','left');
$(dragElement).css('display','inline-table'); 

check now http://jsfiddle.net/DTYEB/32/

Upvotes: 1

unludo
unludo

Reputation: 5016

If you look at developer tools, you will find that each div enclosing each images has position absolute with the same coordinates.

The issue is there:

    .container{
    position:absolute;
    width:64px;
    height:64px;
    top:200px; 
    left:300px;
    z-index:0;
}

Do this:

.container{
    width:64px;
    height:64px;
    z-index:0;
}

And create a parent div which has an absolute position.

This is one solution among a lot.

Upvotes: 2

Related Questions