diff --git "a/\351\203\221\347\242\247\344\273\231/2024-10-25\350\277\207\346\270\2412D\344\274\252\345\205\203\347\264\240.md" "b/\351\203\221\347\242\247\344\273\231/2024-10-25\350\277\207\346\270\2412D\344\274\252\345\205\203\347\264\240.md" new file mode 100644 index 0000000000000000000000000000000000000000..6ae2515e421e5d8ccf833f163b0953f7b56e9b20 --- /dev/null +++ "b/\351\203\221\347\242\247\344\273\231/2024-10-25\350\277\207\346\270\2412D\344\274\252\345\205\203\347\264\240.md" @@ -0,0 +1,416 @@ +## 效果图 +[手机电视](http://zhengmuyun.cn/手机电视.mp4) +[旋转](http://zhengmuyun.cn/旋转.mp4) +[火箭](http://zhengmuyun.cn/火箭.mp4) +[扑克牌](http://zhengmuyun.cn/扑克牌.mp4) +[正反面](http://zhengmuyun.cn/正反面.mp4) +### 重要代码 +```html + .bo{ + height: 300px; + width: 800px; + background-color: white; + position: absolute; + left: 50%; + top:50%; + transform: translate(-50%,-50%); + transition: all 1s linear 0s; + } + .bo:hover{ + background-color: gainsboro; + } + .o1{ + height: 280px; + width: 240px; + background-color: white; + position: relative; + float: left; + overflow: hidden; + margin: 10px 10px 20px 10px; + } + .n1{ + height: 80px; + width: 100%; + position: absolute; + top:264px; + transition: all 1s; + background-color: orange; + } + .o1:hover{ + transform: translateY(-5px); + box-shadow: 0px 0px 15px gray; + } + .o1:hover .n1 { + transform: translateY(-60px); + } +----------------------------------------------- + div{ + height: 200px; + width: 200px; + background-color: red; + color: white; + font-size: 50px; + margin: 60px auto; + /* 过渡 */ + transition: all 1s ease-in-out 0s ; + } + div:hover{ + /* 旋转 */ + transform:rotate(-400deg); + } +----------------------------------------------- + div{ + height: 600px; + width: 600px; + margin: 0 auto; + background-color: orange; + } + img{ + color: white; + } + + .i{ + height: 200px; + position: absolute; + top:300px; + left:200px ; + overflow: hidden; + transform:translate(-50px ,200px)rotate(45deg); + transition: all 1s linear ; + + } + body:hover .i{ + transform:translate(740px,-460px) rotate(45deg); + } +------------------------------------------------------ + .o1{ + position: relative; + height: 500px; + width: 600px; + + } + img{ + height: 400px; + width: 300px; + /* 子绝父相 是图片层叠 */ + position: absolute; + left: 400px; + top: 100px; + /* 转换中心点 transform-origin: 水平方向 垂直方向; */ + transform-origin: center bottom; + transition: all 1s ease-in-out 0s; + /* 阴影程度 */ + box-shadow: 0px 0px 5px gray; + } + .o1:hover :nth-child(1){ + transform: rotate(-60deg); + } + .o1:hover :nth-child(2){ + transform: rotate(-50deg); + } + .o1:hover :nth-child(3){ + transform: rotate(-40deg); + } + .o1:hover :nth-child(4){ + transform: rotate(-30deg); + } + .o1:hover :nth-child(5){ + transform: rotate(-20deg); + } + .o1:hover :nth-child(6){ + transform: rotate(-10deg); + } + .o1:hover :nth-child(7){ + transform: rotate(0deg); + } + .o1:hover :nth-child(8){ + transform: rotate(10deg); + } + .o1:hover :nth-child(9){ + transform: rotate(20deg); + } + .o1:hover :nth-child(10){ + transform: rotate(30deg); + } + .o1:hover :nth-child(11){ + transform: rotate(40deg); + } + .o1:hover :nth-child(12){ + transform: rotate(50deg); + } + .o1:hover :nth-child(13){ + transform: rotate(60deg); + } +-------------------------------------------- + .o1{ + width: 100%; + height: 400px; + background-color: skyblue; + position: relative; + } + .o2,.o3{ + height: 301px; + width: 300px; + margin: 0 auto; + border-radius: 100%; + position: absolute; + left: 400px; + top: 30px; + transition: all 1s linear 0s; + /* 元素的背面不显示 */ + backface-visibility: hidden; + } + .o2{ + background-image: url(./image/1分钱.png); + background-repeat: no-repeat; + background-position: 0 -1px; + transform: rotateY(0deg); + } + .o3{ + background-image: url(./image/1分钱.png); + background-repeat: no-repeat; + background-position: -305px -1px; + transform: rotateY(180deg); + } + .o1:hover .o2{ + transform: rotateY(180deg); + } + .o1:hover .o3{ + transform: rotateY(0deg); + } +``` +## 结构伪类选择器 +1. 格式(重要) +- `E:first-child` 匹配父元素的第一个子元素E。 + +- `E:last-child` 匹配父元素的最后一个子元素E。 + +- `E:nth-child(n)` 匹配父元素的第n个子元素E。**注意**,盒子的编号是从`1`开始算起,不是从`0`开始算起。 + +- `E:nth-child(odd)` 匹配奇数 + +- `E:nth-child(even)` 匹配偶数 + +- `E:nth-last-child(n)` 匹配父元素的倒数第n个子元素E。 + +```html +