两队PK进度条效果

.pk-detail-con{width: 375px;text-align: center;color: #e3c898;font-size: .32rem;}
.progress, .progress-bar{position: relative;}
.progress{width: 100%;height: 38px;line-height: 38px;color: #f3eee1;letter-spacing: 1px;font-size:14px;overflow: hidden;z-index: 1;background-color: #db1d4e;border-radius: 19px;}
.progress-bar{height: 38px;text-align: left;background-color: #4c3de0;-moz-transition: width .6s ease;-webkit-transition: width .6s ease;transition: width .6s ease;}
.progress, .progress-bar{background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%);background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%);background-image: linear-gradient(rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%);}
.lightning, .team-name{position: absolute;}
.lightning{top: 0;right: -13px;width: 25px;height: 38px;background: url("img/pk-lightning.png") no-repeat center;background-size: cover;}
.team-name{top: 0;}
.team-l{left: 23px;}
.team-r{right: 23px;}
.vote-nums{line-height: 2;}
.vnums-l{float: left;margin-left: 23px;}
.vnums-r{float: right;margin-right: 23px;}
 <div class="pk-detail-con">
    <div class="progress" >
      <div class="progress-bar" style="width: 50%;">
        <i class="lightning"></i>
      </div>
      <span class="team-name team-l">蓝队</span>
    	<span class="team-name team-r">红队</span>
    </div>
    <span class="vote-nums vnums-l">5票</span>
    <span class="vote-nums vnums-r">5票</span>
  </div> 

上面代码出现问题:

1..progress设置了border-radius即overflow: hidden,发现部分浏览器相出现子元素圆角超出部分未被隐藏,解决:添加z-index:1;

2.因为.progress使用了overflow: hidden,.progress, .progress-bar又都设置了定位position: relative,导致IOS手机蓝条遮盖红条部分未遮全,下方露出一小条红色。解决如下去掉.progress, .progress-bar的定位:

.pk-detail-con{position: relative;width: 375px;}
.progress{width: 100%;height: 38px;overflow: hidden;background-color: #db1d4e;border-radius: 19px;}
.progress-bar{height: 38px;text-align: left;background-color: #4c3de0;-moz-transition: width .6s ease;-webkit-transition: width .6s ease;transition: width .6s ease}
.progress, .progress-bar{background-image: -moz-linear-gradient(rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%);background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%);background-image: linear-gradient(rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 50%);}
.lightning{width: 25px;height: 38px;float: right;margin-right: -12px;background: url("img/pk-lightning.png") no-repeat center;background-size: cover;}
.team-name{position: absolute;top: 0;line-height: 38px;color: #f3eee1;letter-spacing: 1px;font-size: 14px;}
.team-l{left: 23px;}
.team-r{right: 23px;}
.vote-nums{line-height: 2;color: #e3c898;font-size: 12px;}
.vnums-l{float: left;margin-left: 23px;}
.vnums-r{float: right;margin-right: 23px;}
<div class="pk-detail-con">
    <div class="progress" >
      <div class="progress-bar" style="width: 50%;">
        <i class="lightning"></i>
      </div>
    </div>
    <span class="team-name team-l">蓝队</span>
    <span class="team-name team-r">红队</span>
    <span class="vote-nums vnums-l">5票</span>
    <span class="vote-nums vnums-r">5票</span>
</div>  

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值