<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0px;
padding: 0px;
list-style: none;
}
ul{
width: 291px;
height: 512px;
background: red;
}
ul li{
width: 291px;
height: 161px;
background: lawngreen;
margin-bottom: 14px;
overflow: hidden;
position: relative;
}
image{
width: 291px;
}
p{
position: absolute;
bottom: 0px;
left: 0px;
width: 259px;
padding: 8px 16px;
/*rgba透明色 rgb红绿蓝 a透明度0-1*/
background: rgba(0, 0, 0, 0.3);
color: white;
font-size: 17px;
line-height: 19px;
}
span{
position: absolute;
top: 30px;
left: 30px;
width: 30px;
height: 30px;
text-align: center;
line-height: 30px;
background: yellow;
border-radius: 50%;
transform: rotate(-30deg);
}
</style>
</head>
<body>
<ul>
<li><img src="../s02.jpg" alt="">
<p>这是个台灯这是个台灯这是个台灯这是个台灯这是个台灯这是个台灯这是个台灯这是个台灯这是个台灯</p>
<span>攒</span>
</li>
<li></li>
<li></li>
</ul>
</body>
</html>
绝对定位和相对定位经常是成对使用的,用了绝对定位的标签会显示在相对定位的标签的上面,也可以想象成相对定位是底层,相对于相对定位是绝对的,在他上层就是绝对定位