css经典案例---

1.骰子

<head>  
<style>
        .all{
            display: flex;
            flex-wrap: wrap;
        }
        /* 一 */
        .one{
            width: 200px;
            height: 200px;
            border: 1px solid #000 ;
            border-radius: 30px;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        .one .circle{
            width: 50px;
            height: 50px;
            background-color: #000;
            border-radius: 50%;

        }
        /* 二 */
        .two{
            width: 200px;
            height: 200px;
            border: 1px solid #000;
            border-radius: 30px;
            display: flex;
            justify-content: space-between;
          
        }
        .two .circle{
            width: 50px;
            height: 50px;
            background-color: #000;
            border-radius: 50%;
            margin: 10px;
        }
      
       .two .twosecend{
        display: flex;
        align-items: flex-end;

       }
       /* 三 */
       .three{
            width: 200px;
            height: 200px;
            border: 1px solid #000;
            border-radius: 30px;
        }
        .three .circle{
            width: 50px;
            height: 50px;
            background-color: #000;
            border-radius: 50%;
            margin: 10px;
        }
        .three .threefirst{
            height: 33%;
            display: flex;
        }
        .three .threesecend{
            height: 33%;
            display: flex;
            justify-content: center;
        }
        .three .threethird{
            height: 33%;
            display: flex;
            justify-content: flex-end;
        }
        /* 四 */
        .four{
            width: 200px;
            height: 200px;
            border: 1px solid #000;
            border-radius: 30px;
            display: flex;
            flex-wrap: wrap;
            align-content: space-between;

        }
        .four .circle{
            width: 50px;
            height: 50px;
            background-color: #000;
            border-radius: 50%;
            margin: 10px;
            display: inline-block;
            
        }
        .four .fourfirst{
            width: 100%;
            display: flex;
            justify-content: space-between;
        }
        .four .foursecend{
            width: 100%;
            display: flex;
            justify-content: space-between;
        }
        /* 五 */
        .five{
            width: 200px;
            height: 200px;
            border: 1px solid #000;
            border-radius: 30px;
            display: flex;
            flex-wrap: wrap;
            align-content: space-between;

        }
        .five .circle{
            width: 50px;
            height: 50px;
            background-color: #000;
            border-radius: 50%;
            margin: 10px;
            display: inline-block;
            
        }
        .five .fivefirst{
            width: 100%;
            height: 33%;
            display: flex;
            justify-content: space-between;
        }
        .five .fivesecend{
            width: 100%;
            height: 33%;
            display: flex;
            justify-content: center;
        }
        .five .fivethird{
            width: 100%;
            height: 33%;
            display: flex;
            justify-content: space-between;
        }
        /* 六 */
        .six{
            width: 200px;
            height: 200px;
            border: 1px solid #000;
            border-radius: 30px;
            display: flex;
            flex-wrap: wrap;
            align-content: space-between;
            

        }
        .six .circle{
            width: 50px;
            height: 50px;
            background-color: #000;
            border-radius: 50%;
            display: inline-block;
            margin: 5px;
            
        }
        .six .sixfirst{
            width: 100%;
            display: flex;
            justify-content: space-evenly;
        }
        .six .sixsecend{
            width: 100%;
            display: flex;
            justify-content: space-evenly;
        }
    </style>
</head>

<body>
<div class="all">
    <!-- 一 -->
    <div class="one">
        <div class="circle"></div>
    </div>
    <!-- 二 -->
    <div class="two">
            <div class="circle"></div>
        <div class="twosecend">
            <div class="circle"></div>
        </div>
    </div>
    <!-- 三 -->
    <div class="three">
        <div class="threefirst">
            <div class="circle"></div>
        </div>
         <div class="threesecend">
            <div class="circle"></div>
         </div>
         <div class="threethird">
            <div class="circle"></div>
         </div>
    </div>
    <!-- 四 -->
    <div class="four">
        <div class="fourfirst">
            <div class="circle"></div>
            <div class="circle"></div>
        </div>
         <div class="foursecend">
            <div class="circle"></div>
            <div class="circle"></div>
         </div>
    </div>
    <!-- 五 -->
    <div class="five">
        <div class="fivefirst">
            <div class="circle"></div>
            <div class="circle"></div>
        </div>
         <div class="fivesecend">
            <div class="circle"></div>
         </div>
         <div class="fivethird">
            <div class="circle"></div>
            <div class="circle"></div>
         </div>
    </div>
    <!-- 六 -->
    <div class="six">
        <div class="sixfirst">
            <div class="circle"></div>
            <div class="circle"></div>
            <div class="circle"></div>
        </div>
         <div class="sixsecend">
            <div class="circle"></div>
            <div class="circle"></div>
            <div class="circle"></div>
         </div>
    </div>
    </div>
</body>

 2.光斑+文字裁切


<head> 
<style>
        body{
            background-color: #333;
        }
        .box{
            width: 600px;
            height: 300px;
            border: 20px solid #ccc;
            margin: 0 auto ;
            font-size: 80px;
            font-weight: bold;
            text-align: center;
            line-height: 300px;
            background-image:linear-gradient(to right, rgba(255,0,0,0) 0,#fff 2%,#fff 4% ,rgba(255,0,0,0) 6% ),url(./img/bg.jpg);
            background-clip: text;
            color: transparent;
            transition: all 1s;
        }
       .box:hover{
            background-position: 580px 0,0 0; 
        } 
    </style>
</head>
<body>
    <div class="box">
        这个杀手不太冷
    </div>
</body>
</html>

 3.跳动的心❤

<html>
<head>  
<style>
        body{
            background-color: pink;
            animation: body 1s infinite linear;
            
    
        }
        @-webkit-keyframes body{
            0%{
                background-color: pink;
            }
            100%{
                background-color: lightblue;
            }
        }
        .love1{
            width: 300px;
            height: 300px;
            background-color: red;
            transform: rotate(45deg);
            margin: 200px auto;
            border: 1px solid red;
            animation: one 1s ease-in;
            animation-iteration-count: infinite ;
        
        }
        @-webkit-keyframes one{
            
            50%{
                transform:rotate(45deg) scale(1.2);
                
                
            }
        }
     
        .love1::before{
            content: "";
            width: 300px;
            height: 300px;
            background-color: red;
            position: absolute;
            top: 0;
            left: -150px;
            border-radius: 50%;

        }
        .love1::after{
            content: "";
            width: 300px;
            height: 300px;
            background-color: red;
            position: absolute;
            top: -150px;
            left: 0;
            border-radius: 50%;

        }
        .love2{
            width: 200px;
            height: 200px;
            background-color: green;
            position: relative;
            z-index: 2;
            border: 1px solid green;
            transform: rotate(45deg);
            position: absolute;
            top: 245px;
            left: 635px;
            animation: two 1s ease-out;
            animation-iteration-count: infinite ;
            
        }
        @-webkit-keyframes two{
            50%{
                transform:rotate(45deg) scale(1.2);
                
            }
        }
        .love2::before{
            content: "";
            width: 200px;
            height: 200px;
            background-color: green;
            position: absolute;
            top: 0;
            left: -100px;
            border-radius: 50%;
        }
        .love2::after{
            content: "";
            width: 200px;
            height: 200px;
            background-color: green;
            position: absolute;
            top: -100px;
            left: 0;
            border-radius: 50%;
        }
        .love3{
            width: 100px;
            height: 100px;
            z-index: 3;
            position: relative;
            background-color: blue;
            transform: rotate(45deg);
            position: absolute;
            left: 685px;
            top: 305px;
            animation: three 1s ease-in-out;
            animation-iteration-count: infinite ;
        }
        @-webkit-keyframes three{
            50%{
                transform:rotate(45deg) scale(1.2);
                
                
            }
        }
        .love3::before{
            content: "";
            width: 100px;
            height: 100px;
            background-color: blue;
            position: absolute;
            top: 0;
            left: -50px;
            border-radius: 50%;
        }
        .love3::after{
            content: "";
            width: 100px;
            height: 100px;
            background-color: blue;
            position: absolute;
            top: -50px;
            left: 0;
            border-radius: 50%;
        }
    </style>
</head>
<body>
    <div class="love1"> </div>
    <div class="love2"> </div>
    <div class="love3"></div>
</body>
</html>

4.西游记

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body{
            margin: 0 ;
            padding: 0;
        }
        .box{
            width: 100%;
            height: 100vh;
            background:url(./img/10.jpg);
            background-repeat: repeat-x;
            animation: box 20s infinite linear ;
           position: relative;
        }
        @-webkit-keyframes box{
           0%{
            background-position: 0 0;
           }
           100%{
            background-position: 1920px 0;
           }
        }
        .wk{
            width: 200px;
            height: 180px;
            background-image: url(./img/1.png);
            position: absolute;
            top: 390px;
            left: 202px;
        animation: one steps(8,start)  1s infinite;
        }
        .bj{
            width: 200px;
            height: 180px;
            background-image: url(./img/2.png);
            position: absolute;
            top: 390px;
            left: 390px;
        animation: one steps(8,start)  1s infinite;
        }
        .ts{
            width: 170px;
            height: 240px;
            background-image: url(./img/3.png);
            position: absolute;
            top: 360px;
            left: 600px;
             animation: two steps(8,start)  1s infinite;
        }
        .swk{
            width: 210px;
            height: 200px;
            background-image: url(./img/4.png);
            position: absolute;
            top: 390px;
            left: 800px;
        animation: three steps(8,start)  1s infinite;
        }
        @-webkit-keyframes one{
            0%{
            background-position: 0 0;
           }
           100%{
            background-position: -1600px 0;
           }
        }
        @-webkit-keyframes two{
            0%{
            background-position: 0 0;
           }
           100%{
            background-position: -1360px 0;
           }
        }
        @-webkit-keyframes three{
            0%{
            background-position: 0 0;
           }
           100%{
            background-position: -1680px 0;
           }
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="wk"></div>
        <div class="bj"></div>
        <div class="ts"></div>
        <div class="swk"></div>
    </div>
</body>
</html>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值