0

i have two divs , one is higher than other , what i want is to put the first one that's higher inside the other .

#bottom {
    overflow-x:scroll ;
    overflow-y: hidden;
    white-space: nowrap;    
    position:fixed;
    height:45px;
    width:864px;
    background-color:yellow;
    bottom:0px;
    margin-left:144px;
}
.box {
display: inline-block;
cursor: pointer ;
vertical-align: middle;
width:200px; height:525px; 
background:blue;
left:144px; 
margin-right: 16px
}

5 Answers5

0

From what I understand, you want to put one div inside another? You do that in your markup, not the css.

Can you please post your HTML as well, and your question might be a bit clearer.

Edit: http://jsfiddle.net/gF8ch/1/ Jsfiddle with div inside div.

Simon L
  • 36
  • 3
0

You can't do it only with CSS and HTML You can use jQuery:

$('#whereToPut').appendTo('#whatToPut');
nicael
  • 18,550
  • 13
  • 57
  • 90
0

Try this...You want to set the position of the divs..

.box {
position: absolute;
display: inline-block;
cursor: pointer ;
vertical-align: middle;
width:200px; height:525px; 
background:blue;
left:144px; 
margin-right: 16px
}

#bottom {
    position: relative;
    overflow-x:scroll ;
    overflow-y: hidden;
    white-space: nowrap;    
    position:fixed;
    height:45px;
    width:864px;
    background-color:yellow;
    bottom:0px;
    margin-left:144px;
}

You want to make the higher Position:absolute and the second div Position:relative and after that you can place the second div inside the higher div..

You can refer the following links for clarifications..

Positioning two divs..

Positioning html controls..

Community
  • 1
  • 1
Jameem
  • 1,840
  • 3
  • 15
  • 26
0

Try this (My Understanding is that you want change the child to parent and parent to child)

var bottom = document.getElementById("bottom");
var box = document.getElementById("box");

bottom.parentNode.appendChild(box); // appending box to the bottom's parent
bottom.innerHTML = "";              // clearing bottom's children
box.appendChild(bottom);            // appending bottom to box
Senthil
  • 249
  • 1
  • 2
  • 10
0

Try to add this in the div's style that you want to be the top :

z-index:10000;

If not enough change 10000 to something you want.

Jamie
  • 1,096
  • 2
  • 19
  • 38