CSS+DIV进度条
2015-03-22 15:36
225 查看
<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="width: 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; }
相关文章推荐
- div css实现进度条
- 纯DIV+CSS实现进度条
- css+div模拟进度条
- div+css 百分比进度条
- div+css进度条
- 纯DIV+CSS百分比进度条
- css+div图片滚动效果
- 很好用的前台页面模板 DIV+CSS
- div+css div不设置高度背景颜色或外边框不能显示的解决方法
- DIV+CSS设计时浏览器兼容性
- DIV+CSS页面设计中的IE6的文字溢出BUG
- DIV+CSS定义滚动条样式,实现内嵌效果
- DIV+CSS架构下 在一个DIV中居中另一个DIV
- div+css实现左中右布局,解决右边一块掉落的问题
- JQuery/AjaX/Javascript/DIV+CSS资源下载地址
- Div+CSS布局入门教程5
- DIV中滚动条设置到随机位置(CSS+Javascript)
- DIV+CSS两种盒子模型
- div+css设计中ID的命名习惯和规范
- CSS+DIV背景透明