我在#contenitore中有两个div#div-1和#div-2。
我想将#div-2移到#div-1与css。
#div-2具有可变高度,不固定。
html代码如下:
<div id="contenitore">
<div id="div-1"></div>
<div id="div-2"></div>
</div>
你可以用css帮我吗?感谢
答案 0 :(得分:0)
这是一个完整的演示。只需复制并粘贴到编辑器并找出css规则。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#container {
width:450px;
height:550px;
background:#CCC;
margin:0 auto;
text-align:center;
}
#divOne {
width:250px;
height:200px;
background:#3F9;
position:absolute;
top:250px;
}
#divTwo {
width:250px;
height:200px;
background:#F66;
position:absolute;
}
</style>
</head>
<body>
<div id="container">
<div id="divOne">Div One</div>
<div id="divTwo">Div Two</div>
</div>
</body>
</html>