I used CSS Triangle method to create progress steps: http://plnkr.co/edit/cPsvVIlKX2gQseONTixf?p=preview
Problem, is that when zooming browser in or out (90% and 110% in chrome e.g.), then there is gap between triangle and the element it has to be connected with.
.steps {
list-style-type: none;
padding: 0;
}
.steps li {
display: inline-block;
margin-bottom: 3px;
}
.steps li a, .steps li p {
background: #e5f4fd;
padding: 8px 20px;
color: #0077bf;
display: block;
font-size: 14px;
font-weight: bold;
position: relative;
text-indent: 12px;
}
.steps li a:hover, .steps li p:hover {
text-decoration: none;
}
.steps li a:before, .steps li p:before {
border-bottom: 18px solid transparent;
border-left: 12px solid #fff;
border-top: 18px solid transparent;
content: "";
height: 0;
position: absolute;
left: 0;
top: 50%;
width: 0;
margin-top: -18px;
}
.steps li a:after, .steps li p:after {
border-bottom: 18px solid transparent;
border-left: 12px solid #e5f4fd;
border-top: 18px solid transparent;
content: "";
height: 0;
position: absolute;
right: -12px;
top: 50%;
width: 0;
margin-top: -18px;
z-index: 1;
}
.steps li.active a, .steps li.active p {
background: #0077bf;
color: #fff;
}
.steps li.active a:after, .steps li.active p:after {
border-left: 12px solid #0077bf;
}
.steps li.undone a, .steps li.undone p {
background: #eee;
color: #333;
}
.steps li.undone a:after, .steps li.undone p:after {
border-left: 12px solid #eee;
}
.steps li.undone p {
color: #aaa;
}
Examples:
Any ideas how to fix it?
For these types of positioning issues, it's often useful not to use set pixel values but let the natural values work for you.
So..
Change this
.steps li a:after, .steps li p:after {
border-bottom: 18px solid transparent;
border-left: 12px solid #e5f4fd;
border-top: 18px solid transparent;
content: "";
height: 0;
position: absolute;
/*right: -12px;*/ /* remove this */
left:100%; /* add this */
top: 50%;
width: 0;
margin-top: -18px;
z-index: 1;
}
Demo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With