我已经做了某种逆向工程,使Bootstrap中的nav-tabs组件成为一个步骤元素。这类似于语义UI中使用的步骤元素
现在,我设法做到这一点(覆盖nav-tabs CSS并添加箭头的样式)但是有一些我无法弄清楚的问题
有关此的任何提示吗?这是一些伪类设置我缺少或重复某处!
.nav-steps>.step:after {
position: absolute;
z-index: 2;
content:'';
top: 0em;
right: -22px;
border-bottom: 23px solid transparent;
border-left: 23px solid orange;
border-top: 24px solid transparent;
}
.nav-steps .step:hover:after {
border-left-color: pink;
}
http://jsfiddle.net/chou_one/NemwU/
P.S可能有一个更清洁的方法,可能有跨度?
答案 0 :(得分:2)
你添加99%正确:)而不是将ARROW添加到<li>
,你需要将其添加到<a>
, where is a working demo 。
CSS代码更改:
.steps-headers {
text-align: center;
}
.nav-steps {
border: none;
padding-bottom: 1px;
background-color: orange;
display: inline-block;
overflow: hidden;
}
.nav-steps>li>a {
margin-right: 0px;
line-height: 1.428571429;
width: 180px;
}
/* step arrow style */
.nav-steps>.step a:after {
position: absolute;
z-index: 2;
content: '';
top: 0px;
right: -30px;
border-bottom: 23px solid transparent;
border-left: 23px solid orange;
border-top: 20px solid transparent;
width: 31px;
}
/* disable step arrow style for last item */
.nav-steps>.step:last-child a:after {
display: none;
}
/* HOVER STYLE */
/* hover state */
.nav-steps>li a:hover {
background-color: pink;
color: white;
border-radius: 0px;
}
/* step arrow color on hover:after */
.nav-steps .step:hover a:after {
border-left-color: pink;
}
/* ACTIVE STYLE */
/* active state */
.nav-steps>li.active>a, .nav-steps>li.active>a:hover, .nav-steps>li.active>a:focus {
background-color: yellow;
color: black;
border-radius: 0px;
}
/* step arrow color on active:after */
.nav-steps .step.active a:after {
border-left-color: yellow;
}