• 73.纯 CSS 创作一只卡通狐狸


    原文地址:https://segmentfault.com/a/1190000015566332

    学习效果地址:https://scrimba.com/c/cz6EzdSd

    感想:过渡效果,圆角,定位。

    HTML code:

    <div class="fox">
        <div class="head">
            <span class="faces"></span>
            <span class="eyes"></span>
            <span class="ears"></span>
            <span class="nose"></span>
        </div>
        <div class="tail"></div>
    </div>

    CSS code:

    html, body {
        margin: 0;
        padding: 0;
    }
    body{
        /* 设置body的子元素水平垂直居中 */
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        /* 定义一个背景变量 */
        --bc: teal;
        background-color: var(--bc);
    }
    /* 设置fox容器样式 */
    .fox{
        position: relative;
        font-size: 30px;
        width: 7em;
        height: 9em;
        border: 1px solid white;
        /* 定义字体颜色变量 */
        --c: chocolate;
        color: var(--c);
        /* 过渡时间 */
        transition: 1s;
    }
    .fox:hover{
        --c: lightblue;
    }
    .fox .head{
        position: absolute;
        right: 0;
        width: 6em;
        height: 6em;
        border-radius: 50%;
        background-color: currentColor;
    }
    /* 画出脸颊 */
    .fox .faces::before,
    .fox .faces::after{
        position: absolute;
        top: 3em;
        content:'';
        width: 3em;
        height: 3em;
        border-radius: 0 100% 0 100%;
        background-color: white;
    }
    .fox .faces::after {
        right: 0;
        transform: rotate(-90deg);
    }
    /* 画出眼睛 */
    .fox .eyes::before,
    .fox .eyes::after{
        position: absolute;
        top: 4.5em;
        content: '';
        border: 0.3em solid;
        border-color: black black transparent transparent;
        border-radius: 50%;
    }
    .fox .eyes::before {
        left: 1em;
    }
    .fox .eyes::after {
        right: 1em;
        transform: rotate(-90deg);
    }
    /* 画出耳朵 */
    .fox .ears::before,
    .fox .ears::after {
        position: absolute;
        content:'';
        width: 3em;
        height: 3em;
        background-color: currentColor;
        filter: brightness(1.25);
        border-radius: 0 100% 0 0;
        z-index: -1;
    }
    .fox .ears::after {
        right: 0;
        transform: rotate(-90deg);
    }
    /* 画出鼻子 */
    .fox .nose{
        position: absolute;
        top: calc(6em - 1em / 2);
        right: calc((6em - 1em) / 2);
        width: 1em;
        height: 1em;
        border-radius: 50%;
        background-color: black;
        transform: scale(0.9);
    }
    /* 画出尾巴 */
    .fox .tail{
        position: absolute;
        bottom: 0;
        width: 7em;
        height: 7em;
        border-radius: 50%;
        background-color: currentColor;
        z-index: -1;
        overflow: hidden;
    }
    /* 去掉尾巴左上角的扇形 */
    .fox .tail::before{
        position: absolute;
        content:'';
        width: calc(7em / 2);
        height: calc(7em / 2);
        border-radius: 100% 0 0 0;
        background-color: var(--bc);
    }
    /* 尾巴尖 */
    .fox .tail::after {
        content: '';
        position: absolute;
        width: 1em;
        height: 1em;
        border-radius: 0 0 100% 0;
        background: white;
        bottom: calc(7em / 2 - 1em);
    }
  • 相关阅读:
    java.sql.SQLException: 不支持的字符集 (在类路径中添加 orai18n.jar): ZHS16GBK
    STS工具各版本下载网址
    SpringBoot访问不了JSP但却能进入后台
    springboot o.a.tomcat.util.scan.StandardJarScanner : Failed to scan [file:/D:/apache-maven-3.0.5[系统找不到指定路径]
    STS工具:mybayis连接oracle数据库
    springBoot怎样访问静态资源?+静态资源简介
    springboot注解
    8.12-14 df 、mkswap、swapon、swapoff、sync
    8.5-7 mkfs、dumpe2fs、resize2fs
    8.2-3 partprobe、tune2fs
  • 原文地址:https://www.cnblogs.com/FlyingLiao/p/10700536.html
Copyright © 2020-2023  润新知