DIV跨层的问题……

yzb85 2008-09-12 10:26:55
<div id="d1">

<div id="d2">
</div>
</div>

我希望d1能够移出d2,我又不想用iframe(iframe如果没有足够大的位置会有滚动条,不好看)怎么做?
...全文
113 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
yzb85 2008-09-17
  • 打赏
  • 举报
回复
谢谢大家,已经搞定,关键是position:absolute,该层的父容器同样需要这个属性才行.
jcy787211820 2008-09-17
  • 打赏
  • 举报
回复
只要使DIV2脱离标准流就移 出拉,
我觉得可以用float加上margin属性移动,或者用定位属性,absolute,relavite或者fixed加上位置top,bottom,left,right;
fengzi1220 2008-09-16
  • 打赏
  • 举报
回复
2个层分开 绝对定位 可以重叠
cngothic 2008-09-14
  • 打赏
  • 举报
回复
绝对定位.外加top:.. left:...
zc_0101 2008-09-13
  • 打赏
  • 举报
回复
。。。。移出。。。。。
sjmlsxp 2008-09-12
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zhihuixiaole 的回复:]
sha yi si
[/Quote]
啥意思?
同感,不明白
jenisonqq 2008-09-12
  • 打赏
  • 举报
回复
用绝对位置定位
zhihuixiaole 2008-09-12
  • 打赏
  • 举报
回复
d1能够移出d2?sha yi si
懒牛科技 2008-09-12
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 lingyun410 的回复:]
HTML code
<style type="text/css">
<!--
#div1{
width:400px;
height:200px;
background:#0099CC;
border:1px solid #000;
position:relative;
left:200px;
top:100px;
z-index:1;
}
#div2{
position:absolute;
left:10px;
top:-20px;
z-index:2;
width:100px;
height:100px;
background:#CC9933;
border:1px solid #000;
filter: alpha(opacity=80);
}
-…
...
[/Quote]
....
blueidea123 2008-09-12
  • 打赏
  • 举报
回复
position: absolute
position: relative
bestdowt1314 2008-09-12
  • 打赏
  • 举报
回复

<style type="text/css">
#d1 {
position: absolute
}
#d2 {
position: relative;
left:-50px;
top:-50px;
}
</style>

<div id="d1">

<div id="d2">
</div>
</div>

lingyun410 2008-09-12
  • 打赏
  • 举报
回复
<style type="text/css">
<!--
#div1{
width:400px;
height:200px;
background:#0099CC;
border:1px solid #000;
position:relative;
left:200px;
top:100px;
z-index:1;
}
#div2{
position:absolute;
left:10px;
top:-20px;
z-index:2;
width:100px;
height:100px;
background:#CC9933;
border:1px solid #000;
filter: alpha(opacity=80);
}
-->
</style>
<div id="div1">
<div id="div2">这里是层2的内容</div>
</div>

这样就OK了!
starwu 2008-09-12
  • 打赏
  • 举报
回复
<style type="text/css">
#d1 {
position: absolute
}
#d2 {
position: relative;
left:-50px;
top:-50px;
}
</style>

<div id="d1">

<div id="d2">
</div>
</div>
yurui05 2008-09-12
  • 打赏
  • 举报
回复
你既然嵌套了 再怎么移出来?
吟风 2008-09-12
  • 打赏
  • 举报
回复
浮动

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧