---
title: "绝对定位和相对定位"
author: "clrw"
date: "2015-06-17T09:17:34Z"
tags: []
categories: ["Web前端"]
slug: "untitled"
draft: false
lastmod: "2015-06-17T09:21:08Z"
id: 2220237
url: "https://clrw.iteye.com/blog/2220237"
---

```
<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>
```

 

一目了然。

 

![](http://dl2.iteye.com/upload/attachment/0109/5583/869740c9-b89f-3c6a-8bdb-f114f9aef287.jpg)