<!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=gb2312" />
<title>绝对定位和相对定位的案例</title>
<style type="text/css">
<!--
.dd {
height: 300px;position:relative;
width: 500px; background:#333;
}
.ff {width:100px;height:100px; background:#fff;position:absolute;top:5px;right:20px;}
-->
</style>
</head>
<body>
<div class="dd">
<div class="ff" ></div>
</div>
</body>
</html>
DIV CSS层内层的绝对和相对定位案例
最新推荐文章于 2025-10-27 12:01:18 发布
本文通过一个简单的HTML页面实例,展示了如何使用CSS中的相对定位和绝对定位来布局元素。页面包含一个大区块背景为深灰色,内部有一个小方块背景为白色,通过定位属性实现了特定的位置摆放。
766

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



