<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link ref="sheetstyle" type="text/css" href="assets/css/iconfont.css">
</head>
<style>
*{
margin: 0;
padding: 0;
}
.box{
width: 390px;
height: 450px;
margin: 100px auto;
}
.act_inner{
position: relative;
width: 100%;
height: 100%;
}
.act_inner:before {
content: '';
position: absolute;
display: block;
width: 340px;
height: 420px;
border: solid 5px #333;
top: 20px;
right: 0;
}
.act_lk{
position: relative;
z-index: 1;
float: right;
width: 340px;
height: 420px;
margin: 0 30px;
}
.act_img{
position: relative;
width: 100%;
height: 100%;
}
.act_inner:after {
content: '';
z-index: 0;
display: block;
position: absolute;
width: 340px;
height: 420px;
right: 30px;
top: 0;
background: #f0f3ef;
}
.container{
position: relative;
width: 50px;
height: 50px;
background: blue;
}
.box1{
position: absolute;
width: 100px;
top: 50px;
left: 0;
background: red;
border: 1px solid #333;
border-radius: 3px;
}
.box1::before{
content: '';
position: absolute;
display: block;
width: 0;
height: 0;
left: 50%;
top: -9px;
border: 5px solid #333;
border-color: transparent transparent red transparent;
}
</style>
<body>
<div class="box">
<div class="act_inner">
<a class="act_lk">
<div class="act_img">
<img src="assets/imgs/pic.png" alt="">
</div>
</a>
</div>
</div>
</body>
</html>
CSS伪类 :before :after的小实例(仿京东)
最新推荐文章于 2024-08-09 16:06:18 发布