- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>开门大吉</title>
- <style type="text/css">
- .a {
- width: 520px;
- height: 280px;
- position: relative;
- margin: 100px auto;
- perspective: 1000px;
- }
- img {
- display: block;
- width: 520px;
- height: 280px;
- }
- div:nth-child(2),div:nth-child(3) {
- width: 50%;
- height: 100%;
- background-color: pink;
- position: absolute;
- border: 1px solid red;
- top: 0;
- transition: all 1s;
- }
- div:nth-child(2)::before ,div:nth-child(3)::before {
- content: "";
- width: 20px;
- height: 20px;
- position: absolute;
- top: 50%;
- transform: translate(0, -50%);
- border: 1px solid red;
- }
- div:nth-child(2)::before {
- right: 0; /*添加门环样式*/
- }
- div:nth-child(3)::before {
- left: 0;
- }
- div:nth-child(2) {
- left: 0;
- transform-origin: left;
- }
- div:nth-child(3) {
- right: 0;
- transform-origin: right;
- }
- div:hover div:nth-child(2){
- transform: rotateY(-90deg);
- }
- div:hover div:nth-child(3){
- transform: rotateY(90deg);
- }
- </style>
- </head>
- <body>
- <div class="a">
- <img src="sez.jpg">
- <div></div>
- <div></div>
- </div>
- </body>
- </html>
CSS开门大吉
最新推荐文章于 2021-08-11 16:34:58 发布