<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>框架</title>
<style>
.AA{width: 200px; height: 200px;/*宽高*/
background-color: green;
position: fixed;/*相对于浏览器定位牛皮癣广告*/
right: 30px;/*右下交,不写上面没效果*/
bottom: 30px;}
.BB{width: 200px; height: 200px;
background-color: sandybrown;
position: relative;}
.CC{width: 200px; height: 200px;
background-color: darkgoldenrod;
margin-top: 20px;
position: relative;}
/*相对定位---一般默认就是相对定位,相对于别的元素定位,别的元素位置改变
这个位置一样发生改变*/
.DD{position: absolute;/*绝对定位 也要写下面的位置*/
top: 20px;/*绝对定位的位置是相当与上一级来定位的*/
right: 20px;/*定位在CC的右上角*/
width: 100px; height: 100px;
background-color:red;}
.container {
width: 50%;
height: 100px;
border: 3px solid black;
}
.items {
width: 50px;
height: 50px;
background-color: blue;
border: 2px solid red;
float: right;
margin-right: 10px;
font-size: 30px;
color: white;
}
</style>
</head>
<body>
<div class="AA">
</div>
<div class="BB">
<div class="DD"></div>
</div>
<div class="CC">
<div class="DD"></div>
</div>
<div class="DD">
<div class="container">
<div class="items">1</div>
<div class="items">2</div>
<div class="items">3</div>
<div class="items">4</div>
<div class="items">5</div>
<div class="items">6</div>
</div>