[css3] 小案例-扇子

使用到的知识点:过渡,旋转,透明,调整旋转中心,定位

<!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: 0;
            padding: 0;
        }

        ul {
            list-style: none;
        }

        ul {
            width: 600px;
            height: 400px;
            margin: 0 auto;
            border: 5px solid #000;
            position: relative;
        }

        li {
            width: 40px;
            height: 100px;
            float: left;
            background-color: rgb(207, 157, 157);
            /* border: 1px solid #000; */
            position: absolute;
            bottom: 0;
            left: 50%;
            margin-left: -30px;
            box-shadow: 0 0 2px gray;
            transition: all 3s linear;
            transform-origin: center bottom;
            text-align: center;
            border-radius: 3px;
        }

        ul>li:not(:nth-child(7)) {
            opacity: 0;
        }

        ul:hover>li {
            opacity: 1;
        }

        li:nth-child(1),
        li:nth-child(13) {
            background-color: rgb(188, 136, 236);
        }

        li:nth-child(2),
        li:nth-child(12) {
            background-color: rgb(218, 194, 240);
        }

        li:nth-child(3),
        li:nth-child(11) {
            background-color: rgb(173, 174, 238);
        }

        li:nth-child(4),
        li:nth-child(10) {
            background-color: rgb(141, 126, 226);
        }

        li:nth-child(5),
        li:nth-child(9) {
            background-color: rgb(202, 187, 245);
        }

        li:nth-child(6),
        li:nth-child(8) {
            background-color: rgb(150, 144, 236);
        }

        li:nth-child(7) {
            background-color: rgb(187, 174, 245);
        }

        /* 旋转+-90度 */
        ul:hover>li:nth-child(1) {
            transform: rotate(90deg);
        }

        ul:hover>li:nth-child(13) {
            transform: rotate(-90deg);
        }

        /* 旋转+-75度 */
        ul:hover>li:nth-child(2) {
            transform: rotate(75deg);
        }

        ul:hover>li:nth-child(12) {
            transform: rotate(-75deg);
        }

        /* 旋转+-60度 */
        ul:hover>li:nth-child(3) {
            transform: rotate(60deg);
        }

        ul:hover>li:nth-child(11) {
            transform: rotate(-60deg);
        }

        /* 旋转+-45度 */
        ul:hover>li:nth-child(4) {
            transform: rotate(45deg);
        }

        ul:hover>li:nth-child(10) {
            transform: rotate(-45deg);
        }

        /* 旋转+-30度 */
        ul:hover>li:nth-child(5) {
            transform: rotate(30deg);
        }

        ul:hover>li:nth-child(9) {
            transform: rotate(-30deg);
        }

        /* 旋转+-30度 */
        ul:hover>li:nth-child(6) {
            transform: rotate(15deg);
        }

        ul:hover>li:nth-child(8) {
            transform: rotate(-15deg);
        }
    </style>
</head>

<body>
    <!-- 使用到的知识点:过渡,旋转,透明,调整旋转中心,定位 -->
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>

</html>

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值