zoukankan      html  css  js  c++  java
  • CSS3 transition实现男女比例动态加载

    效果图:

    完整代码:

    代码中图片( img1.png:

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <style>
                *{
                    margin: 0;
                    padding: 0;
                }
                span,p{
                    font-family: "Microsoft YaHei", arial, helvetica, clean, sans-serif
                }
                .box1{
                    margin-top:20px;
                }
                .sexdata{
                    display:flex;
                    justify-content:space-between ;
                    width:560px
                }
                .sexdata p span:first-child{
                    margin: 10px;
                }
                .sexchart{
                    display:flex;
                    flex-direction:row;
                }
                .sexchart>span{
                    margin:0 10px;
                }
                .sexper{
                    width:500px;
                    height:14px;
                    background:#608CF8;
                    line-height: 21px;
                    margin-top:5px;
    
                }
                .sexper p{
                    background: #5ce8c4;
                    z-index:10;
                    float:left;
                    width:10%;
                    height:14px;
                    transition: width 2s;
                    -webkit-transition: width 2s; /* Safari 和 Chrome */
                }
                .sexper img{
                    z-index:10;
                    float:left;
                    width:14px;
                    height:14px;
                }
            </style>
        </head>
    
        <body>
            <div class="box1">
                <div class="sexdata">
                    <p>        
                        <span>607923人</span>
                        <span>54.18%</span>
                    </p>
                    <p>        
                        <span>582301人</span>
                        <span>46.82%</span>
                    </p>
        
                </div>
                <div class="sexchart">
                    <span></span>
                    <div class="sexper">
                        <p id="maleper"></p>
                        <img src="img/img1.png"/>
                    </div>
                    <span></span>
                </div>
            </div>
        </body>
        <script>
            //模拟获取数据
            setTimeout(
                function(){
                    document.getElementById("maleper").style.width="54.18%";    
                },500)
            
        </script>
    </html>
  • 相关阅读:
    MySQL 删除有外键约束的表数据
    Python 类装饰器解析
    保持SSH连接的linux服务器不断线
    数字货币交易所常用概念
    Python f-string
    Linux sed命令
    CAS机制详解
    MySQL缓存机制
    PHP网络请求优化
    Java三大特性---继承
  • 原文地址:https://www.cnblogs.com/liangtao999/p/11770445.html
Copyright © 2011-2022 走看看