如何在进度点的边界上叠加进度条线?
How to overlay progress bar line over border of progress point?
因此,我正在开发一个带有步骤的进度向导,但我很难尝试通过进度条 运行 获得圆形进度步骤的特定外观。这是我在 Copepen 上的 HTML/CSS:
http://codepen.io/heysharybobbins/pen/yymXbK
最终,目标是让灰色 and/or 绿色进度线直接合并到实心圆进度步骤(深灰色或绿色)中。此时,灰色或绿色的进度线停在进度圈上设置的边框处:
最终目标是让它看起来像这个 PSD 示例:
http://codepen.io/heysharybobbins/pen/yymXbK
.container {
width: 960px;
margin: 50px auto;
font-family: Arial, sans-serif;
}
.progress-wrap {
height: 16px;
background: #e4e4e4;
border-radius: 3px;
border-top: 1px solid #ccc;
}
.progress-wizard {
padding: 0 0 10px 0;
position: relative;
bottom: 10px;
list-style-type: none;
}
.progress-wizard li {
display: inline-block;
width: 16%;
height: 36px;
font-size: 12px;
text-align: center;
text-indent: -19px;
line-height: 75px;
border-top: 4px solid #ccc;
box-shadow: inset 0 1px 0 #fff;
position: relative;
z-index: 1 !important;
}
.progress-wizard li:before {
position: relative;
float: left;
text-indent: 0;
left: -webkit-calc(50% - 9.5px);
left: -moz-calc(50% - 9.5px);
left: -ms-calc(50% - 9.5px);
left: -o-calc(50% - 9.5px);
left: calc(50% - 9.5px);
}
.progress-wizard li.done {
font-size: 12px;
}
.progress-wizard li.done:before {
content: "✔" !important;
color: white !important;
text-shadow: none !important;
font-size: 14px;
height: 30px;
width: 30px;
line-height: 30px;
top: -19px;
border: none;
border-radius: 19px;
box-shadow: 0 -1px 0 0 #ccc;
}
.progress-wizard li.todo {
font-size: 12px;
border-top-color: #ccc;
position: relative;
color: #999;
}
.progress-wizard li.todo:before {
content: "B24";
font-size: 17.1px;
top: -22px;
line-height: 18.05px;
}
.progress-wizard li.done {
color: #8c9c58;
border-top-color: #8c9c58;
}
.progress-wizard li.done:before {
color: white;
background-color: #8c9c58;
border: 5px solid #e4e4e4;
position: relative;
top: -22px;
}
.progress-wizard li.todo:before {
background: #ccc;
width: 30px;
height: 30px;
border: 5px solid #e4e4e4;
box-shadow: 0 -1px 0 0 #ccc;
border-radius: 60px;
line-height: 30px;
}
.progress-wizard li.stepone:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "1";
}
.progress-wizard li.steptwo:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "2";
}
.progress-wizard li.stepthree:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "3";
}
.progress-wizard li.stepfour:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "4";
}
.progress-wizard li.stepfive:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "5";
}
.progress-wizard li.stepsix:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "6";
}
.progress-wizard li.current {
color: #93b5d3;
}
.progress-wizard li.current:before {
background: #93b5d3;
color: #fff;
text-shadow: none;
}
<div class="container">
<div class="progress-wrap">
<ol class="progress-wizard">
<li class="progress-point done stepone">Information</li><li class="progress-point current todo steptwo">Related Items</li><li class="progress-point todo stepthree">Access</li><li class="progress-point todo stepfour">Uploads</li><li class="progress-point todo stepfive">Availability</li><li class="progress-point todo stepsix">Review</li>
</ol>
</div>
</div>
我在想,为了解决这个问题,它可能与伪元素的 z-index 和伪元素的父元素有关,但我已经尝试了几件事,但没有成功。任何投入将不胜感激。
谢谢!
难道是这个?
.progress-wizard li.done:after {
content: " ";
background-color: #ccc;
position: absolute;
top: -4px;
padding-right: 47px;
left: 107px;
height: 4px;
}
http://codepen.io/anon/pen/wBVxje
编辑:
刚看到一个小问题。您必须仅将此 :after 元素添加到最后一个完成的元素。否则它会覆盖进度条。还好吗?可以用JS去除。
在Bootstrap
.progress-wizard li:before {
position: relative;
float: left;
text-indent: 0;
left: -webkit-calc(50% - 9.5px);
left: -moz-calc(50% - 9.5px);
left: -ms-calc(50% - 9.5px);
left: -o-calc(50% - 9.5px);
left: calc(50% - 9.5px);
box-sizing: content-box;
}
因此,我正在开发一个带有步骤的进度向导,但我很难尝试通过进度条 运行 获得圆形进度步骤的特定外观。这是我在 Copepen 上的 HTML/CSS:
http://codepen.io/heysharybobbins/pen/yymXbK
最终,目标是让灰色 and/or 绿色进度线直接合并到实心圆进度步骤(深灰色或绿色)中。此时,灰色或绿色的进度线停在进度圈上设置的边框处:
最终目标是让它看起来像这个 PSD 示例:
http://codepen.io/heysharybobbins/pen/yymXbK
.container {
width: 960px;
margin: 50px auto;
font-family: Arial, sans-serif;
}
.progress-wrap {
height: 16px;
background: #e4e4e4;
border-radius: 3px;
border-top: 1px solid #ccc;
}
.progress-wizard {
padding: 0 0 10px 0;
position: relative;
bottom: 10px;
list-style-type: none;
}
.progress-wizard li {
display: inline-block;
width: 16%;
height: 36px;
font-size: 12px;
text-align: center;
text-indent: -19px;
line-height: 75px;
border-top: 4px solid #ccc;
box-shadow: inset 0 1px 0 #fff;
position: relative;
z-index: 1 !important;
}
.progress-wizard li:before {
position: relative;
float: left;
text-indent: 0;
left: -webkit-calc(50% - 9.5px);
left: -moz-calc(50% - 9.5px);
left: -ms-calc(50% - 9.5px);
left: -o-calc(50% - 9.5px);
left: calc(50% - 9.5px);
}
.progress-wizard li.done {
font-size: 12px;
}
.progress-wizard li.done:before {
content: "✔" !important;
color: white !important;
text-shadow: none !important;
font-size: 14px;
height: 30px;
width: 30px;
line-height: 30px;
top: -19px;
border: none;
border-radius: 19px;
box-shadow: 0 -1px 0 0 #ccc;
}
.progress-wizard li.todo {
font-size: 12px;
border-top-color: #ccc;
position: relative;
color: #999;
}
.progress-wizard li.todo:before {
content: "B24";
font-size: 17.1px;
top: -22px;
line-height: 18.05px;
}
.progress-wizard li.done {
color: #8c9c58;
border-top-color: #8c9c58;
}
.progress-wizard li.done:before {
color: white;
background-color: #8c9c58;
border: 5px solid #e4e4e4;
position: relative;
top: -22px;
}
.progress-wizard li.todo:before {
background: #ccc;
width: 30px;
height: 30px;
border: 5px solid #e4e4e4;
box-shadow: 0 -1px 0 0 #ccc;
border-radius: 60px;
line-height: 30px;
}
.progress-wizard li.stepone:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "1";
}
.progress-wizard li.steptwo:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "2";
}
.progress-wizard li.stepthree:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "3";
}
.progress-wizard li.stepfour:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "4";
}
.progress-wizard li.stepfive:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "5";
}
.progress-wizard li.stepsix:before {
color: #999;
text-shadow: 1px 1px 0 white;
content: "6";
}
.progress-wizard li.current {
color: #93b5d3;
}
.progress-wizard li.current:before {
background: #93b5d3;
color: #fff;
text-shadow: none;
}
<div class="container">
<div class="progress-wrap">
<ol class="progress-wizard">
<li class="progress-point done stepone">Information</li><li class="progress-point current todo steptwo">Related Items</li><li class="progress-point todo stepthree">Access</li><li class="progress-point todo stepfour">Uploads</li><li class="progress-point todo stepfive">Availability</li><li class="progress-point todo stepsix">Review</li>
</ol>
</div>
</div>
我在想,为了解决这个问题,它可能与伪元素的 z-index 和伪元素的父元素有关,但我已经尝试了几件事,但没有成功。任何投入将不胜感激。
谢谢!
难道是这个?
.progress-wizard li.done:after {
content: " ";
background-color: #ccc;
position: absolute;
top: -4px;
padding-right: 47px;
left: 107px;
height: 4px;
}
http://codepen.io/anon/pen/wBVxje
编辑:
刚看到一个小问题。您必须仅将此 :after 元素添加到最后一个完成的元素。否则它会覆盖进度条。还好吗?可以用JS去除。
在Bootstrap
.progress-wizard li:before {
position: relative;
float: left;
text-indent: 0;
left: -webkit-calc(50% - 9.5px);
left: -moz-calc(50% - 9.5px);
left: -ms-calc(50% - 9.5px);
left: -o-calc(50% - 9.5px);
left: calc(50% - 9.5px);
box-sizing: content-box;
}