如何从数据标签中获取文本以出现在进度条上方而不是内部的文字?
我希望这个栏在上面显示文本。我一直在寻找几个小时,决定离开它,然后我想为什么不问这里,是否有人可以给我一些很棒的见解,谢谢!
.exp_bar_container{
width:100%;
top: 12em;
position: relative;
display:flex;
}
.ExpBar {
height: 0.5em;
width: 100%;
background-color: #dcdcdc;
position: relative;
font-weight:bold;
float: left;
}
.ExpBar:before {
content: attr(data-label);
font-size: 0.8em;
position: absolute;
text-align: center;
left: 0;
right: 0;
}
.ExpBar .value {
background-color: #323334;
display: inline-block;
height: 100%;
}
.ExpBar::-moz-progress-bar {
background: #dcdcdc;
}
.ExpBar::-webkit-progress-value {
background: #630862;
}
.ExpBar::-webkit-progress-bar {
background: #dcdcdc;
}
<div class="exp_bar_container">
<progress id="ExpBarId" class="ExpBar" data-label='20/20' value="1" max="100">
</progress>
</div>
I would like this bar to have the text appear above it. I have been searching for a couple hours, decided to just leave it and then i thought why not ask here, if anyone could give me some insight on this that would be great, thanks!
.exp_bar_container{
width:100%;
top: 12em;
position: relative;
display:flex;
}
.ExpBar {
height: 0.5em;
width: 100%;
background-color: #dcdcdc;
position: relative;
font-weight:bold;
float: left;
}
.ExpBar:before {
content: attr(data-label);
font-size: 0.8em;
position: absolute;
text-align: center;
left: 0;
right: 0;
}
.ExpBar .value {
background-color: #323334;
display: inline-block;
height: 100%;
}
.ExpBar::-moz-progress-bar {
background: #dcdcdc;
}
.ExpBar::-webkit-progress-value {
background: #630862;
}
.ExpBar::-webkit-progress-bar {
background: #dcdcdc;
}
<div class="exp_bar_container">
<progress id="ExpBarId" class="ExpBar" data-label='20/20' value="1" max="100">
</progress>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需添加
top:-1em;
to.expbar:
之前:Just add
top: -1em;
to.ExpBar:before
: