会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
转行了,但是每次上网都会过来看看。或许几年以后我又会从事这个行业。
破晓之阳
关于div相对定位和div绝对定位的说明实例
关于div相对定位和div绝对定位的说明实例
<!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=big5" /> <title>關於div相對定位和div絕對定位的說明實例</title> <style> body {margin: 30px; font-size:9pt;} .a, .b, .c, .d, .e { width: 100px; height: 100px; margin: 5 auto; color: #fff; background: #000; } .aa, .bb, .cc, .dd, .ee { left: 10px; width: 10px; height: 10px; overflow: hidden; background: #F90; } .b, .d, .e {position: relative;} .cc, .dd, .ee {position: absolute;} </style> </head> <body> <div class="a"> <div class="aa"></div> A:均不設置postion,一般嵌套關係 </div> <div class="b"> <div class="bb"></div> B:僅外div設置relative,一般嵌套關係 </div> <div class="c"> <div class="cc"></div> C:僅內div設置absolute,文檔中為嵌套關係,頁面中內div浮起[非float],相對於頁面定位,與外div無關。 </div> <div class="d" style="background:#ff0000"> <div class="dd" ></div> D:外div設置relative,內div設置absolute,內div浮起來並相對於外div定位 </div> <div class="d" style="background:#ff0000"> <div class="dd" style="position:relative"></div> D:外div設置relative,內div設置relative,內div浮起來並相對於外div定位 </div> <div class="e"> <div class="ee" style="left: -10px;"></div> E:這個是說明邊界問題。-10 != 反向10px間距 </div> </body> </html>
法律问题免费作答
posted on
2008-01-08 09:50
破曉之陽
阅读(
7855
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
导航
博客园
首页
新随笔
联系
订阅
管理
公告