我有两个div,一个高于其他div,我想要的是把第一个高于另一个。
#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
}
答案 0 :(得分:0)
根据我的理解,你想把一个div放在另一个里面吗?你在标记中做到这一点,而不是css。
你能否发布你的HTML,你的问题可能会更清楚一些。
修改:http://jsfiddle.net/gF8ch/1/ Jsfiddle with div inside div.
答案 1 :(得分:0)
您不能仅使用CSS
和HTML
来执行此操作
你可以使用jQuery:
$('#whereToPut').appendTo('#whatToPut');
答案 2 :(得分:0)
试试这个...你想设置div的位置..
.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;
}
您想要设置较高的Position:absolute
和第二个div Position:relative
,之后您可以将第二个div放在较高的div中。
您可以参考以下链接进行说明..
答案 3 :(得分:0)
试试这个 (我的理解是你想把孩子改为父母,父母改为孩子)
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
答案 4 :(得分:0)
尝试在div
style
中添加您希望成为最佳人选的内容:
z-index:10000;
如果没有足够的话,可以将10000改为你想要的东西。