<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>绝对定位相对定位</title>
<style>
.fj1
{
position: absolute;
width: 150px;
height: 150px;
border: 1px solid #000;
background: #999;
}
.zj1
{
position: relative;
width: 100px;
height: 100px;
border: 1px solid #F00;
background: #FFF;
z-index: 1;
}
</style>
</head>
<body>
<div>
<div class="fj1">
我在下面 上的发生大幅 上的发生大幅随碟附送的
</div>
<div class="zj1">
我浮动在上面</div>
</div>
</body>
</html>
一目了然。

本文通过HTML和CSS代码示例,详细解释了绝对定位和相对定位的区别,包括它们如何影响网页元素的布局和显示。
771

被折叠的 条评论
为什么被折叠?



