• CSS+DIV进度条


    <style type="text/css">
    .Bar { position: relative; width: 200px;    /* 宽度 */ border: 1px solid #B1D632; padding: 1px; }
    .Bar div { display: block; position: relative; background:#00F;/* 进度条背景颜色 */ color: #333333; 
          height
    : 20px; /* 高度 */ line-height: 20px; /* 必须和高度一致,文本才能垂直居中 */ } .Bar div span{ position: absolute; width: 200px; /* 宽度 */ text-align: center; font-weight: bold; } </style>
    <div class="Bar">
        <div style=" 50%;">
            <span>50%</span>
        </div>
    </div>
      //此方法用于计算百分比
      public String getPercent(int x,int total){ if(x==0&&total!=0){ return "0"; }else if(x==0&&total==0){ return "100%"; } String result="";//接受百分比的值 double x_double=x*1.0; double tempresult=x_double/total; //保留到小数点后几位 DecimalFormat df = new DecimalFormat("0.00%"); //##.00% 百分比格式,后面不足2位的用0补齐 result= df.format(tempresult); //注释掉的也是一种方法 //NumberFormat nf = NumberFormat.getPercentInstance(); //nf.setMinimumFractionDigits( 2 ); //result=nf.format(tempresult);      return result; }
  • 相关阅读:
    Nginx配置IP白名单和黑名单
    MySQL外键的作用和创建
    MySQL命令大全
    Mysql数据类型详解
    常见英文简写
    ubuntu12.04destdrop删除不必要的软件
    Ubuntu Nginx 开机自启动
    再生龙小用------转载
    Clonezilla SE---克隆linux------转载
    linux下制作镜像文件
  • 原文地址:https://www.cnblogs.com/hehaiyang/p/4357418.html
Copyright © 2020-2023  润新知