【发布时间】:2015-04-01 14:22:36
【问题描述】:
我目前正在学习所有关于 css 的知识,所以我正在尝试生成具有不同功能的不同形状。
我目前正在做一个项目,该项目需要一个水平箭头来显示交易发生的“进度”。
所以我正在尝试生成一个箭头“进度条”,例如:
|\
| \
+----------------+ \
|XX| 10% >
+----------------+ /
\ | /
\ |/
\the XX's depict a different color.
我目前能够“填充”到箭头为止,但我生成箭头的方式似乎也无法“填充”它(即大约 90%,一半身体的头部应该是满的)——而不是全部。
我现在的sn-p:
.arrow{
margin:0 auto;
height:100px;
width:200px;
background:red;
margin-top:60px;
position:relative;
/*overflow:hidden;*/
}
.arrow:before, .prog:before{
content:"";
position:absolute;
right:-100px;
border-left:100px solid red;
border-top:100px solid transparent;
border-bottom:100px solid transparent;
top:-50%;
}
.prog{
position:absolute;
height:100%;
width:0%;
background:blue;
transition: all 0.8s;
}
.arrow:hover .prog{
width:100%;
}
.prog:before{
border-left:100px solid transparent;
transition: all 0.8s;
}
.arrow:hover .prog:before{
border-left:100px solid blue;
}
<div class="arrow">
<div class="prog"></div>
</div>
这并没有真正起作用,因为您在箭头的主体之外“看到了点”,使得它看起来像是另一个箭头出现在它的前面,而不是“填充它”。
我使用悬停效果作为演示,虽然我想使用 jquery 来设置完成百分比
【问题讨论】:
标签: jquery css html progress-bar css-shapes