2021-07-29

时钟

<!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;
        }

        /* 设置表的样式 */
        .clock{
            width: 500px;
            height: 500px;
            margin: 0 auto;
            margin-top: 100px;
            border-radius: 50%;
            /* border: 10px solid black; */
            position: relative;
            background-image: url(./img/13/bg.png);
            background-size: cover;
        }

        .clock > div{
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
            margin: auto;
        }

        

        /* 设置时针 */
        .hour-wrapper{
            height: 70%;
            width: 70%;
            animation: run 7200s linear infinite;
        }

        .hour{
            height: 50%;
            width: 6px;
            background-color: #000;
            margin: 0 auto;
        }

        /* 设置分针 */
        .min-wrapper{
            height: 80%;
            width: 80%;
            animation: run 600s steps(60) infinite;
        }

        .min{
            height: 50%;
            width: 4px;
            background-color: #000;
            margin: 0 auto;
        }

        /* 设置秒针 */
        .min-wrapper{
            height: 90%;
            width: 90%;
            animation: run 10s steps(60) infinite;
        }

        .sec{
            height: 50%;
            width: 2px;
            background-color: #f00;
            margin: 0 auto;
        }


        /* 
            旋转的关键帧
        */

        @keyframes run{
            from{
                transform: rotateZ(0);
            }

            to{
                transform: rotateZ(360deg);
            }
        }
    </style>
</head>
<body>

    <!-- 创建表的容器 -->
    <div class="clock">
        <!-- 创建时针 -->
        <div class="hour-wrapper">
            <div class="hour"></div>
        </div>

        <!-- 创建分针 -->
        <div class="min-wrapper">
            <div class="min"></div>
        </div>

        <!-- 创建秒针 -->
        <div class="sec-wrapper">
            <div class="sec"></div>
        </div>
    </div>
    
</body>
</html>

在这里插入图片描述

复仇者联盟

<!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>
        html{
            perspective: 800px;
        }

        .cube{
            width: 202px;
            height: 202px;
            /* background-color: #bfa; */
            margin: 100px auto;
            /* 设置3d变形效果 */
            transform-style: preserve-3d;
            /* transform: rotateX(45deg) rotateZ(45deg); */
            animation: rotate 20s infinite linear;
        }

        .cube > div{
            width: 202px;
            height: 202px;
            /* 为元素设置透明效果 */
            opacity: 0.7;
            position: absolute;

        }

        img{
            vertical-align: top;
        }

        .box1{
            transform: rotateY(90deg) translateZ(100px);
        }

        .box2{
            transform: rotateY(-90deg) translateZ(100px);
        }

        .box3{
            transform: rotateX(90deg) translateZ(100px);
        }

        .box4{
            transform: rotateX(-90deg) translateZ(100px);
        }

        .box5{
            transform: rotateY(180deg) translateZ(100px);
        }

        .box6{
            transform: rotateY(0deg) translateZ(100px);
        }

        @keyframes rotate{
            from{
                transform: rotateX(0) rotateZ(0);
            }

            to{
                transform: rotateX(1turn) rotateZ(1turn);
            }
        }
    </style>
</head>
<body>

    <!-- 创建一个外部的容器 -->
    <div class="cube">
        <!-- 引入图片 -->
        <div class="box1">
            <img src="./img/14/1.png" >
        </div>

        <div class="box2">
            <img src="./img/14/2.png" >
        </div>

        <div class="box3">
            <img src="./img/14/1.png" >
        </div>

        <div class="box4">
            <img src="./img/14/2.png" >
        </div>

        <div class="box5">
            <img src="./img/14/1.png" >
        </div>

        <div class="box6">
            <img src="./img/14/2.png" >
        </div>
    </div>
    
</body>
</html>

在这里插入图片描述

缩放

对元素进行缩放的函数:
scaleX() 水平方向缩放
scaleY() 垂直方向缩放
scale() 双方向的缩放

<!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>
        html{
            perspective: 800px;
        }
        .box1{
            width: 100px;
            height: 100px;
            background-color: #bfa;
            transition: 2s;
            margin: 100px auto;
        }

       

        .box1:hover{
            transform: scale(2);
        }

        .img-wrapper{
            width: 200px;
            height: 200px;
            border: 1px red solid;
            overflow: hidden;
        }

        img{
            transition: .2s;
        }

        .img-wrapper:hover img{
            transform: scale(1.2);
        }
    </style>
</head>
<body>

    <div class="box1"></div>

    <div class="img-wrapper">
        <img src="an.png" width="100%">
    </div>
    
</body>
</html>

在这里插入图片描述

在这里插入图片描述

less的简介

less是一门css的预处理语言
1. less是一个css的增强版,通过less可以编写更少的代码实现更强大的样式
2. 在less中添加了许多的新特性:像对变量 的支持、对mixin的支持… …
3. less的语法大体上和css语法一致,但是less中添加了许多对css的扩展, 所以浏览器无法直接执行less代码,要执行必须将less转换为css,然后再由浏览器执行

less的语法

  1. // less中的单行注释,注释中的内容不会被解析到css中
    /*
    css中的注释,内容会被解析到css文件中
    */
  2. 变量
    在变量中可以储存一个任意的值,并且我们可以在需要时,任意的修改变量中的值
    变量的语法:@变量名
    (1)使用变量时,如果直接使用则以 @变量名 的形式使用即可
    (2)变量发生重名时,会优先使用比较近的变量
    (3)可以在变量声明前就使用变量
    (4)作为类名,或者一部分值使用时必须以 @{变量名} 的形式使用
@a:200px;
@b:#bfa;
@c:box6;

.box5{
    width: @a;
    color: @b;
}
.@{c}{
    width:@a;
    background-image: url("@{c}/1.png");
}

@d:200px;
@d:300px;

div{
    @d:115px;
    width: @d;
    height: @e;
}

@e:335px;

div{
    width: 300px;
    // 新版的语法
    height: $width;
}
  1. & 就表示外层的父元素
.box1{
    .box2{
        color: red;
    }

    >.box3{
        color: red;

        &:hover{
            color: blue;
        }  
    }
    &:hover{
        color: orange;
    }
    div &{
        width: 100px;
    }
}

4.:extend() 对当前选择器扩展指定选择器的样式(选择器分组)

.p1{
    width: 100px;
    height: 200px;
}
.p2:extend(.p1){
    color: red;
}

5.直接对指定的样式进行引用,这里就相当于将p1的样式在这里进行了复制

.p1{
    width: 100px;
    height: 200px;
}
.p3{
    .p1();
}

6.使用类选择器时可以在选择器后边添加一个括号,这时我们实际上就创建了一个mixin

.p4(){
    width: 100px;
    height: 100px;
    background-color: #bfa;
}

.p5{
    .p4;
}

7.混合函数 在混合函数中可以直接设置变量

.test(@w:100px,@h:200px,@bg-color:red){
    width: @w;
    height: @h;
    border: 1px solid @bg-color;
}

.div{
    // 调用混合函数,按顺序传递参数
    // .test(200px,300px,#bfa);
    .test(300px);
    // .test(@bg-color:red,@h:100px,@w:300px);
}

8.可以通过import来将其他的less引入到当前的less中

@import "syntax2.less";

9.在less中所有的数值都可以直接进行运算 + - * /

 	width: 100px + 100px;
    height: 100px/2;
    background-color: #bfa;
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值