• html+css3实现骰子


    1、效果

    2、html代码:

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8">
        <title>dice game</title>
        <link rel="stylesheet" type="text/css" href="css/main.less">
    </head>
    
    <body>
        <div class="container">
            <ul class='cube'>
                <li class='slide front n1'>
                    <span></span>
                </li>
                <li class='slide back n6'>
                 <p>
                        <span></span>
                        <span></span>
                        <span></span>
                    </p>
                    <p>
                        <span></span>
                        <span></span>
                        <span></span>
                    </p>
                    
                </li>
                <li class='slide left n5'>
                    <p>
                        <span></span>
                        <span></span>
                    </p>
                    <p><span></span></p>
                    <p>
                        <span></span>
                        <span></span>
                    </p>
                </li>
                <li class='slide right n3'>
                    <span></span>
                    <span></span>
                    <span></span>
                </li>
                <li class='slide top n4'>
                    <span></span>
                    <span></span>
                    <span></span>
                    <span></span>
                </li>
                <li class='slide bottom n2'>
                    <span></span>
                    <span></span>
                </li>
            </ul>
        </div>
        <script type="text/javascript" src='js/jquery-2.2.1.min.js'></script>
        <script type="text/javascript" src='js/main.js'></script>
    </body>
    
    </html>
    

      3、css代码

    * {
        margin: 0;
        padding: 0;
        list-style: none;
    }
    
    body {
         100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.4);
        overflow: hidden;
    }
    
    .container {
         100%;
        height: 100%;
        position: fixed;
        top: 0%;
        left: 0%;
        border-radius: 50px;
    }
    
    .cube {
        position: absolute;
         400px;
        height: 400px;
        top: 0;
        left: 0;
        line-height: 400px;
        text-align: center;
        transform-style: preserve-3d;
        font-size: 50px;
        cursor: pointer;
        transition: all 0.3s ease-in-out;
        animation: demo 1s alternate infinite;
    }
    
    .slide {
         100%;
        height: 100%;
        position: absolute;
        border: 1px solid gray;
        border-radius: 50px;
        top: 0;
        left: 0;
        color: red;
        background: white;
    }
    
    span {
        display: inline-block;
         100px;
        height: 100px;
        border-radius: 50px;
        background-color: blue;
        box-shadow: inset 0 0 50px 3px rgba(0, 0, 0, 0.5);
    }
    
    .front {
        transform: translateZ(200px);
    }
    
    .n1 span {
         200px;
        height: 200px;
        border-radius: 100px;
        background-color: red;
        margin: 0 auto;
        vertical-align: middle;
        box-shadow: inset 0 0 100px 3px rgba(0, 0, 0, 0.5);
    }
    
    .bottom span {
        text-align: center;
    }
    
    .left span {}
    
    .top span {}
    
    .n5 p {
        display: block;
         360px;
        height: 100px;
        margin: 20px;
        &:nth-child(1) {
            span:nth-child(1) {
                float: left;
            }
            span:nth-child(2) {
                float: right;
            }
        }
        &:nth-child(2) {
            margin: 0 0 0 150px;
        }
        &:nth-child(3) {
            span:nth-child(1) {
                float: left;
            }
            span:nth-child(2) {
                float: right;
            }
        }
    }
    
    .n2 span {
        float: left;
        &:nth-child(1) {
            margin: 150px 50px 0 100px;
        }
        &:nth-child(2) {
            margin: 150px 0 0 0;
        }
    }
    
    .n6 p {
         300px;
        height: 100px;
        text-align: center;
        line-height: 100px;
        margin: 50px auto 50px auto;
    }
    
    .n6 span {
        float: left;
    }
    
    .back {
        transform: translateZ(-200px) rotateY(180deg);
    }
    
    .left {
        transform: rotateY(90deg) translateZ(200px);
    }
    
    .n3 span {
         100px;
        height: 100px;
    }
    
    .n4 span {
        float: left;
        margin: 50px;
    }
    
    .right {
    
        transform: rotateY(-90deg) translateZ(200px);
    }
    
    .top {
        transform: rotateX(-90deg) translateZ(200px);
    }
    
    .bottom {
        transform: rotateX(90deg) translateZ(200px);
    }
    
    
    @keyframes demo {
        from {
            top: 0;
            left: 0;
            transform: rotateX(0deg) rotateY(0deg);
        }
        to {
            top: 600px;
            left: 1000px;
            transform: rotateX(360deg) rotateY(360deg);
        }
    }
    

    4、总结:

    存在间隙

  • 相关阅读:
    国内高通量基因测序公司成立 时间表
    递推法(归纳法)
    1. 基础知识 (直方图 柱状图 正态分布 模型 抽样分布 )
    1. 基础概念 (统计分布 抽样 置信区间 标准差)
    史上最全 | 39个RNAseq分析工具与对比
    转录组分析工具大比拼 (完整翻译版)
    C#、.NET Framework、CLR的关系
    C#程序集及程序集概念介绍
    SSM处理 No 'Access-Control-Allow-Origin' header is present on the requested resource 问题
    mybatis字符#与字符$的区别
  • 原文地址:https://www.cnblogs.com/SunlikeLWL/p/7346759.html
Copyright © 2020-2023  润新知