zoukankan      html  css  js  c++  java
  • 弹性盒子+CSS3帧动画

    <!DOCTYPE html>
    <html lang="en">

    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    * {
    margin: 0px;
    padding: 0px;
    box-sizing: border-box;
    }

    .box {
    400px;
    height: 400px;
    background: #999999;
    border-radius: 10px;
    display: flex;
    /* 横向 */
    /* flex-direction: row; */
    /* 换行*/
    /* flex-wrap: nowrap; */
    /* justify-content: center; 居中对齐 */
    /* justify-content: space-between 两端对齐 */
    /* justify-content: space-around; 两端间隔相等 */
    /* align-items: flex-start; 顶端对齐 */
    /* align-items: center; 居中对齐 */
    /* align-items: flex-end; 底部对齐 */
    /* align-items: baseline; 基线对齐 */
    /* 多根轴线对齐方式 */
    /* align-content: flex-start; 与交叉轴起点对齐 */
    /* align-content: center; 与交叉轴中点对齐 */
    /* align-content: flex-end; 与交叉轴终点对齐 */
    /* align-content: space-between; 与交叉轴两端对齐,轴线之间的间隔平均分布 */
    /* align-content: space-around; 每根轴线两侧的间隔相等,轴线之间的间隔比轴线与边框的间隔大一倍 */
    /* align-content: stretch(默认值); 轴线占满整个交叉轴 */
    }

    .box div {
    100px;
    height: 100px;
    border: 1px solid black;
    border-radius: 10px;
    animation: one 2s;
    background: linear-gradient(to right, red, yellow);
    animation-iteration-count: infinite;
    /* flex-grow: 1; 项目放大比例 */
    }

    .box p {
    animation: two 2s;
    animation-iteration-count: infinite;
    background: linear-gradient(to right, blue, red);
    200px;
    height: 100px;
    border: 1px solid black;
    border-radius: 10px;
    /* flex-grow: 1; 项目放大比例 */
    /* flex-shrink: 1; */
    }

    .box p:nth-of-type(2) {
    flex-shrink: 0;
    align-self: center;
    }

    .box p:nth-of-type(3) {
    align-self: flex-end;
    }

    /* .box div:nth-child(2){
    font-size: 60px;
    order: -1; 项目排序
    }
    .box div:nth-child(3){
    font-size: 40px;
    }
    .box div:nth-child(4){
    font-size: 20px;
    } */
    @keyframes one {
    0% {
    background: linear-gradient(to right, yellow, red);
    }

    25% {
    background: linear-gradient(to right, red, yellow);
    }

    50% {
    background: linear-gradient(to right, yellow, red);
    }

    75% {
    background: linear-gradient(to right, red, yellow);
    }

    100% {
    background: linear-gradient(to right, yellow, red);
    }
    }

    @keyframes two {
    0% {
    background: linear-gradient(to right, red, blue);
    }

    25% {
    background: linear-gradient(to right, blue, red);
    }

    50% {
    background: linear-gradient(to right, red, blue);
    }

    75% {
    background: linear-gradient(to right, blue, red);
    }

    100% {
    background: linear-gradient(to right, red, blue);
    }
    }
    </style>
    </head>

    <body>
    <div class="box">
    <div>1</div>
    <p>1</p>
    <p>2</p>
    <p>3</p>
    </div>
    </body>

    </html>
  • 相关阅读:
    PHP引用与global操作符
    php关联数组与索引数组及其显示
    vim列模式
    PHP 魔术方法之__set() __get() 方法
    给图片、表格、公式自编号
    如何将本地项目与coding.net/github上的项目绑定
    用 ElementTree 在 Python 中解析 XML
    用 ElementTree 在 Python 中解析 XML
    正则表达式介绍
    一个javascript面试题解析
  • 原文地址:https://www.cnblogs.com/sunyang-001/p/10957900.html
Copyright © 2011-2022 走看看