CSS process flow arrows - bad formatting? - html

I modified 3 different peoples code to make css arrows and I think I made it more complicated than it needs to be. Any CSS expert than can help me clean this up?
I can't seem to modify padding and other attributes to get this where I want it within the divs.
css
<style>
/* These are the Stage Arrows - styles */
#testStatus {
position: relative;
width: auto;
height: 30px;
left: 10px;
}
.testStatus li {
position: relative;
text-indent: 10px;
height: 30px;
display: inline-block;
zoom: 1;
margin-left: -3px;
padding: 10px 10px 10px 10px;
color: white;
font-size: 12px;
text-align: center;
line-height: auto;
}
ul.testStatus {
list-style: none;
}
li.testStatus:first-child:after, li.testStatusGood:after, li.testStatusNoGood:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-top: 15px solid transparent;
border-left: 10px solid #767676;
border-bottom: 15px solid transparent;
margin: -10px 0px 0px 10px;
z-index: 3;
}
li.testStatus:last-child:before, li.testStatusGood:before, li.testStatusNoGood:before {
content: "";
position: absolute;
width: 0;
height: 0;
left: 0;
border-top: 15px solid transparent;
border-left: 10px solid #EEEEEE;
border-bottom: 15px solid transparent;
margin: -10px 0px 0px 0px;
z-index: 2;
}
li.testStatus:first-child {
padding-left: 10px;
margin-left: 0;
background-color: #767676;
}
li.testStatus:last-child {
padding-right: 10px;
background-color: #767676;
}
li.testStatusGood {
background-color: #77a942;
}
li.testStatusGood:after {
border-left: 10px solid #77a942;
}
li.testStatusNoGood {
background-color: #c42c00;
}
li.testStatusNoGood:after {
border-left: 10px solid #c42c00;
}
/* End arrow formatting */
</style>
html
<ul>
<li>
<div id="testStatus">
<ul class="testStatus">
<li class="testStatus">Step 1</li>
<li class="testStatusGood">Step 2</li>
<li class="testStatusNoGood">Step 3</li>
<li class="testStatusNoGood">Step 4</li>
<li class="testStatus">Step 5</li>
</ul>
</div>
</li>
</ul>
My arrows display nicely but I am having difficulty adjusting the padding to 0. I've tried the #, the ul class, the il class and I am a bit baffled why I cannot remove the 10px (I believe its the padding).
There is also a faintly darker border on the left side of the triangular portion of the arrows, if you look closely, that I'd like to have match the color exactly.
Duo's code output above image, Ojer code output below image
I'm going backwards :)

Here you go:
.breadcrumbs {
border: 1px solid #cbd2d9;
border-radius: 0.3rem;
display: inline-flex;
overflow: hidden;
}
.breadcrumbs__item {
background: #fff;
color: #333;
outline: none;
padding: 0.75em 0.75em 0.75em 1.25em;
position: relative;
text-decoration: none;
transition: background 0.2s linear;
}
.breadcrumbs__item:hover:after,
.breadcrumbs__item:hover {
background: #edf1f5;
}
.breadcrumbs__item:focus:after,
.breadcrumbs__item:focus,
.breadcrumbs__item.is-active:focus {
background: #323f4a;
color: #fff;
}
.breadcrumbs__item:after,
.breadcrumbs__item:before {
background: white;
bottom: 0;
clip-path: polygon(50% 50%, -50% -50%, 0 100%);
content: "";
left: 100%;
position: absolute;
top: 0;
transition: background 0.2s linear;
width: 1em;
z-index: 1;
}
.breadcrumbs__item:before {
background: #cbd2d9;
margin-left: 1px;
}
.breadcrumbs__item:last-child {
border-right: none;
}
.breadcrumbs__item.is-active {
background: #edf1f5;
}
/* Some styles to make the page look a little nicer */
body {
color: #323f4a;
background: #f5f7fa;
display: flex;
align-items: center;
justify-content: center;
}
html, body {
height: 100%;
}
.gray{
background-color:gray;
}
.breadcrumbs__item.gray:after{
background-color:gray;
}
.red{
background-color:red;
}
.breadcrumbs__item.red:after{
background-color:red;
}
.green{
background-color:green;
}
.breadcrumbs__item.green:after{
background-color:green;
}
<li class="breadcrumbs">
Prospect
Opportunity
Accound
Sales
Support
</li>

This can work for you.
Check this Pen
HTML:
<ul class="steps">
<li class="past">
<span>
<strong>Step 1</strong>
</span><i></i>
</li>
<li class="present">
<span>
<strong>Step 2</strong>
</span><i></i>
</li>
<li class="future">
<span>
<strong>Step 3</strong>
</span><i></i>
</li>
<li class="future1">
<span>
<strong>Step 4</strong>
</span><i></i>
</li>
<li class="present1">
<span>
<strong>Step 5</strong>
</span><i></i>
</li>
</ul>
CSS:
.steps {
padding-left: 0;
list-style: none;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 12px;
line-height: 1;
margin: 30px auto;
border-radius: 3px;
}
.steps strong {
font-size: 14px;
display: block;
line-height: 2.1;
}
.steps > li {
position: relative;
display: block;
/* border: 1px solid #ddd; */
padding: 12px 50px 8px 50px;
width: 140px;
height: 40px;
}
#media (min-width: 768px) {
.steps > li {
float: left;
}
.steps .past {
color: #fff;
background: blue;
}
.steps .present {
color: #000;
background: yellow;
}
.steps .future {
color: #fff;
background: green;
}
.steps .present1 {
color: #000;
background: red;
}
.steps .future1 {
color: #fff;
background: purple;
}
.steps .present1 {
color: #fff;
}
.steps li > span:after,
.steps li > span:before {
content: "";
display: block;
width: 0px;
height: 0px;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: #f0f0f0;
border-width: 30px;
}
.steps li > span:after {
top: -4px;
z-index: 1;
border-left-color: white;
border-width: 34px;
}
.steps li > span:before {
z-index: 2;
}
.steps li.past + li > span:before {
border-left-color: blue;
}
.steps li.present + li > span:before {
border-left-color: yellow;
}
.steps li.future + li > span:before {
border-left-color: green;
}
.steps li.future1 + li > span:before {
border-left-color: purple;
}
.steps li:first-child > span:after,
.steps li:first-child > span:before {
display: none;
}
/* Arrows at start and end */
.steps li:first-child i,
.steps li:last-child i {
display: block;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: white;
border-width: 30px;
}
.steps li:last-child i {
left: auto;
right: -30px;
border-left-color: transparent;
border-top-color: white;
border-bottom-color: white;
}
}

Related

CSS selectors stepper arrows

I have a stepper with an arrow pointing to the right from stage 1 to stage 5.
I want to change the color of the previous and the next arrow for the current stage when I move my mouse over them.
The first problem is that I dont know how to get the arrows (pseudo elements) with css selectors and make them change color the same time with the span element.
The second problem it that the arrow of the current stage is red and the next arrow can not form a parallelogram.. It doesn't look nice
.steps {
padding-left: 0;
list-style: none;
font-size: 13px;
line-height: 1;
margin: 0px auto;
border-radius: 3px;
}
.steps strong {
font-size: 14px;
display: block;
line-height: 1.3;
}
.steps>li {
position: relative;
display: block;
/* border: 1px solid #ddd; */
padding: 12px 20px 8px 50px;
width: 20%;
height: 58px;
}
#media (min-width: 768px) {
.steps>li {
float: left;
}
.steps .past {
color: #777;
background: #f4f4f4;
}
.steps .present {
color: #fff;
background-color: #c32611;
}
.steps .future {
color: #777;
background: #f4f4f4;
}
.steps strong {}
.steps li>span:after,
.steps li>span:before {
content: "";
display: block;
width: 0px;
height: 0px;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: #f0f0f0;
border-width: 29px 30px;
}
.steps li>span:after {
top: -5px;
z-index: 1;
border-left-color: white;
border-width: 34px;
}
.steps li>span:before {
z-index: 2;
}
.steps li.past+li>span:before {
border-left-color: #f4f4f4;
}
.steps li.present+li>span:before {
border-left-color: #c32611;
}
.steps li.future+li>span:before {
border-left-color: #f4f4f4;
}
.steps li:first-child>span:after,
.steps li:first-child>span:before {
display: none;
}
/* Arrows at start and end */
.steps li:first-child i,
.steps li:last-child i {
display: block;
position: absolute;
top: 0;
left: 0;
border: solid transparent;
border-left-color: white;
border-width: 30px;
}
.steps li:last-child i {
left: auto;
right: -30px;
border-left-color: transparent;
border-top-color: white;
border-bottom-color: white;
}
<ul class="steps">
<!--past present future-->
<li class="past" onMouseOver="this.style.background='#e3e3e3'" onMouseOut="this.style.background='transparent'" style="cursor: pointer;">
<span wicket:id="stage31"><strong>Stage 1</strong>Start</span><i></i></li>
<li class="past" onMouseOver="this.style.background='#e3e3e3'" onMouseOut="this.style.background='transparent'" style="cursor: pointer;">
<span wicket:id="stage32"><strong>Stage 2</strong>This is stage 2</span><i></i></li>
<li class="present"><span><strong>Stage 3</strong>This is stage 3</span><i></i></li>
<li class="future" onMouseOver="this.style.background='#e3e3e3'" onMouseOut="this.style.background='transparent'" style="cursor: pointer;">
<span wicket:id="stage34"><strong>Stage 4</strong>This is stage 4</span><i></i></li>
<li class="future"><span><strong>Stage 5</strong>Finish</span><i></i></li>
</ul>

Chevron buttons

I'm looking to achieve this with CSS:
and this is what I've got:
.breadcrumb {
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
margin: 0;
padding: 0;
}
.breadcrumb li {
float: left;
}
.breadcrumb li a {
border: 1px solid #c00;
color: black;
text-decoration: none;
padding: 10px 0 10px 55px;
background: #fff;
position: relative;
display: block;
float: left;
}
.breadcrumb li a:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
/* Go big on the size, and let overflow hide */
border-bottom: 50px solid transparent;
border-left: 30px solid #fff;
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.breadcrumb li a:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
/* Go big on the size, and let overflow hide */
border-bottom: 50px solid transparent;
border-left: 30px solid red;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 1px;
left: 100%;
z-index: 1;
}
.breadcrumb li:first-child a {
padding-left: 10px;
}
.breadcrumb li a:hover {
background: hsla(34, 85%, 25%, 1);
}
.breadcrumb li a:hover:after {
border-left-color: hsla(34, 85%, 25%, 1) !important;
}
.breadcrumb li:last-child a {
border-right: 1px solid red;
}
.breadcrumb li:last-child a:before {
border-left: 0 solid transparent;
}
<ul class="breadcrumb">
<li>Home</li>
<li>Vehicles</li>
</ul>
Issues:
Can't get the right side borders to show correctly
Can't get the right border of last element to be normal (not a chevron)
Can't get hover state right because of right side borders.
Here's is my working jsFiddle
.breadcrumb {
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
margin: 0;
padding: 0;
}
.breadcrumb li {
float: left;
position: relative;
background: #fff;
margin: 0 5px;
}
.breadcrumb li a {
border: 1px solid #0976a1;
color: #0976a1;
text-decoration: none;
padding: 10px 10px 10px 32px;
position: relative;
display: block;
z-index: 99;
font-weight: bold;
}
.breadcrumb li:first-child a {
padding-left: 10px;
border-right: none;
}
.breadcrumb li:last-child a {
border-left: none;
}
.breadcrumb li:before, .breadcrumb li:after{
content: " ";
display: block;
width: 33px;
height: 29px;
border-top: 5px solid transparent;
border-bottom: 1px solid #0976a1;
border-right: 1px solid #0976a1;
position: absolute;
top: 4px;
z-index: -1;
background: #fff;
transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
}
.breadcrumb li:before {
left: 87%;
}
.breadcrumb li:after {
left: 81%;
}
.breadcrumb li:first-child:before, .breadcrumb li:first-child:after{ z-index: 1; }
.breadcrumb li:first-child:after{ left: 73%; }
.breadcrumb li:last-child:before, .breadcrumb li:last-child:after{
display: none;
}
.breadcrumb li:first-child:hover:after, .breadcrumb li:hover{ background: #0976a1; }
.breadcrumb li:hover a{ border-color: transparent; }
.breadcrumb li:hover a{ color: #fff; }
<ul class="breadcrumb">
<li>Home</li>
<li>Vehicles</li>
</ul>
I hope this will help you :)
I think this code is helpful.
.breadcrumb {
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
margin: 0;
padding: 0;
}
.breadcrumb li {
float: left;
margin-right: 10px;
}
.breadcrumb li:first-child {
z-index: 9;
position:relative;
}
.breadcrumb li a {
border: 1px solid #006A9C;
color: black;
text-decoration: none;
padding: 10px 10px 10px 10px;
background: #fff;
position: relative;
display: block;
float: left;
}
.breadcrumb li:first-child a:after {
border-color:#fff;
border-style: solid;
border-width: 15px;
bottom: -30px;
box-shadow: 0 0 0 0 #c00, -1px 1px 0 1px #006A9C;
content: "";
height: 0;
position: absolute;
right: -29px;
transform: rotate(-135deg);
transform-origin: 0 0 0;
width: 0;
z-index: -1;
}
.breadcrumb li:first-child a {
border-right: 0;
}
.breadcrumb li:last-child a {
border-left: 0;
}
.breadcrumb li:last-child a:after{
display:none;
}
.breadcrumb li:last-child a:before{
border-color:#fff;
border-style: solid;
border-width: 15px;
bottom: -30px;
box-shadow: 0 0 0 0 #006A9C, -1px 1px 0 1px #006A9C;
content: "";
height: 0;
position: absolute;
left: -1px;
transform: rotate(-135deg);
transform-origin: 0 0 0;
width: 0;
}
.breadcrumb li:last-child a {
padding-left: 28px;
}
.breadcrumb li a:hover {
background: #006A9C;
color: #fff;
}
.breadcrumb li a:first-child:hover::after {
border-color:#006A9C;
}
<ul class="breadcrumb">
<li>Home</li>
<li>Vehicles</li>
</ul>
*{
margin: 0;
padding: 0;
}
.container{
margin: 20px;
display: flex;
flex-direction: row;
border: 1px solid skyblue;
width: 200px;
overflow: hidden;
}
.left,.right{
display: inline-block;
//border: 1px solid black;
line-height: 50px;
width: 100px;
height: 100%;
position: relative;
}
.right{
text-align: center;
}
p:hover{
background-color: skyblue;
color: white;
}
.left::after{
content:'';
position: absolute;
left: 70px;
top: 3px;
display: inline-block;
width: 45px;
height: 45px;
z-index: 2;
background:white;
transform:rotate(-45deg);
border-right: 1px solid skyblue;
border-bottom: 1px solid skyblue;
}
.left:hover::after{
background-color: skyblue;
}
<div class="container">
<p class="left">LEFT</p>
<p class="right">RIGHT</p>
</div>
It is doing my best.
I hope it will be useful for you.

Use pseudoclasses to create a CSS progress bar / stepper

I am building a stepper, trying to achieve this:
I've built the following, but the problem is the color overflows on the right side of the bar.
.onboarding-steps {
display: flex;
}
.onboarding-steps-container {
background-color: #393D66;
border-top: 1px solid #AEAEAE;
border-bottom: 1px solid #AEAEAE;
background-position: -50% 0;
}
.onboarding-step.active {
color: white;
}
.onboarding-step.active ~ .onboarding-step {
background-color: #fff;
}
.container-fluid {
max-width: 94px;
margin-right: auto;
margin-left: auto;
}
.list-reset {
list-style: none;
padding: 0;
margin: 0;
}
.onboarding-step {
-ms-flex-positive: 1;
flex-grow: 1;
padding: 1.8rem 1rem 1.8rem 1.5rem;
}
<nav class="onboarding-steps-container">
<div class="container-fluid">
<ul class="list-reset clearfix onboarding-steps">
<li class="onboarding-step">
1
</li>
<li class="onboarding-step active">
2
</li>
<li class="onboarding-step">
3
</li>
<li class="onboarding-step">
4
</li>
</ul>
</div>
</nav>
I have also tried a variation by using a pseudoselector as such:
li.onboarding-step.active:before {
background-color: #f9f9f9;
content: '';
left: 0;
right: 0;
top: 0;
bottom: 0;
height: 100%;
position: absolute;
}
.onboarding-steps-container {
position: relative;
}
in that case the color goes on the entire bar.
Here is an example.
.breadcrumb {
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
height: 36px;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
padding-right: 35px;
}
.breadcrumb li {
text-decoration: none;
padding: 10px;
position: relative;
cursor: pointer;
flex: auto;
border: 1px solid red;
}
.breadcrumb li span {
font-size: 11px;
display: inline-block;
width: 16px;
line-height: 16px;
border-radius: 50%;
background-color: white;
vertical-align: middle;
text-align: center;
margin-left: calc(100% - 8px);
}
.breadcrumb li:after {
content: "";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid #393D66;
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.breadcrumb li:before {
content: "";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid white;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 2px;
left: 100%;
z-index: 1;
}
li {
background-color: #393D66;
}
li:first-child {} li.active ~ li {
background-color: #f5f5f5;
}
li.active ~ li:after {
border-left-color: #f5f5f5;
}
li.active ~ li:before {
border-left-color: #d5d5d5;
}
li.active ~ li span {
background-color: #c5c5c5;
color: white;
}
<div class="stepper">
<ul class="breadcrumb">
<li><span>1</span>
</li>
<li><span>2</span>
</li>
<li class="active"><span>3</span>
</li>
<li><span>4</span>
</li>
<li><span>5</span>
</li>
</ul>
</div>
I'm not sure if you're looking for an answer which alters the <li> elements before and after the active <li> and the first <li> but here's a solution for that if you need one. Otherwise pretty much same stuff as Pugazh's answer.
html,
body {
background-color: #ccc;
}
.onboarding-steps {
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
}
.onboarding-steps li {
float: left;
}
.onboarding-steps li span {
color: white;
text-decoration: none;
padding: 10px 20px 10px 45px;
background: #393D66;
position: relative;
display: block;
float: left;
}
.onboarding-steps li span i {
display: block;
padding: 0 5px;
width: 5px;
height: 15px;
font-size: 10px;
background-color: white;
color: grey;
border-radius: 50%;
border: 1px solid grey;
}
.onboarding-steps li:first-child span {
padding: 10px 50px 10px 65px;
}
.onboarding-steps li.active ~ li span {
color: black;
background: #ffffff;
}
.onboarding-steps li span:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid #393D66;
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.onboarding-steps li.active ~ li span:after {
border-left: 30px solid #ffffff;
}
.onboarding-steps li span:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid white;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 1px;
left: 100%;
z-index: 1;
}
.onboarding-steps li.active ~ li span:before {
border-left: 30px solid grey;
}
<ul class="onboarding-steps">
<li>
<span><i>1</i></span>
</li>
<li class="active">
<span><i>2</i></span>
</li>
<li>
<span><i>3</i></span>
</li>
<li>
<span><i>4</i></span>
</li>
</ul>
EDIT:
Here's another example. I even made the items clickable so that you can see how the background reacts with the <li> with active class.
var elements = document.querySelectorAll(".list-item");
for (var i = 0; i < elements.length; i++) {
elements[i].addEventListener("click", function() {
for (var i = 0; i < elements.length; i++) {
elements[i].classList.remove("active");
}
this.classList.add("active");
});
}
html,
body {
background-color: #ccc;
}
.onboarding-container {
background: #FFFFFF;
border: 2px solid black;
padding: 30px;
}
.onboarding-steps {
width: 100%;
max-width: 900px;
margin: 0 auto;
padding: 0;
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
display: flex;
}
.onboarding-steps li {
position: relative;
background: #393D66;
border-top: 1px solid grey;
border-bottom: 1px solid grey;
padding: 10px 30px 10px 40px;
flex: 1;
transition: flex 300ms linear 0s, background 100ms linear 0s;
}
.onboarding-steps li.active {
flex: 0 0 200px;
transition: flex 300ms linear 0s, background 100ms linear 0s;
}
.onboarding-steps li:first-child {
padding: 10px 30px 10px 10px;
}
.onboarding-steps li:last-child {
margin-right: -1px;
}
.onboarding-steps li span {
display: block;
padding: 0 5px;
width: 5px;
height: 15px;
font-size: 10px;
background-color: white;
color: grey;
border-radius: 50%;
border: 1px solid grey;
}
.onboarding-steps li:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid #393D66;
position: absolute;
top: 50%;
margin-top: -20px;
left: 100%;
margin-left: -2px;
z-index: 2;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid white;
position: absolute;
top: 50%;
margin-top: -20px;
margin-left: -1px;
left: 100%;
z-index: 1;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li:last-child:after {
margin-left: -22px;
}
.onboarding-steps li:last-child:before {
margin-left: -21px;
border-top: 20px solid #ffffff;
border-bottom: 20px solid #ffffff;
}
.onboarding-steps li.active ~ li {
background: #ffffff;
}
.onboarding-steps li.active ~ li:after {
border-left: 20px solid #ffffff;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li.active ~ li:before {
border-left: 20px solid grey;
transition: border-left 100ms linear 0s;
}
<div class="onboarding-container">
<ul class="onboarding-steps">
<li class="list-item active">
<span>1</span>
</li>
<li class="list-item">
<span>2</span>
</li>
<li class="list-item">
<span>3</span>
</li>
<li class="list-item">
<span>4</span>
</li>
</ul>
</div>
EDIT 2:
Based on your comment I made one more example and this is probably the closest you can get with just using CSS. Hopefully this will help you. Please do open it in fullscreen to see it working.
var elements = document.querySelectorAll(".list-item");
for (var i = 0; i < elements.length; i++) {
elements[i].addEventListener("click", function() {
for (var i = 0; i < elements.length; i++) {
elements[i].classList.remove("active");
}
this.classList.add("active");
});
}
html,
body {
background-color: #ccc;
}
* {
box-sizing: border-box;
}
.onboarding-container {
width: 100%;
background: #FFFFFF;
border: 2px solid black;
padding: 20px 0px;
}
.onboarding-container-inner {
position: relative;
width: 100%;
border-top: 1px solid grey;
border-bottom: 1px solid grey;
background: transparent;
z-index: 1;
overflow: hidden;
}
.onboarding-steps:before {
content: "";
display: inline-block;
width: 40%;
background: #393D66;
left: 0;
top: 0;
height: 100%;
position: absolute;
}
.onboarding-steps:after {
content: "";
display: inline-block;
width: 40%;
background: #ffffff;
right: 0;
top: 0;
height: 100%;
position: absolute;
z-index: -1;
}
.onboarding-steps {
width: 100%;
max-width: 600px;
margin: 0 auto;
padding: 0;
list-style: none;
font: 18px Helvetica, Arial, Sans-Serif;
display: flex;
}
.onboarding-steps li {
position: relative;
background: #393D66;
padding: 10px 30px 10px 40px;
flex: 1;
transition: flex 300ms linear 0s, background 100ms linear 0s;
}
.onboarding-steps li.active {
//flex: 0 0 200px;
transition: flex 300ms linear 0s, background 100ms linear 0s;
}
.onboarding-steps li:first-child {
padding: 10px 30px 10px 10px;
}
.onboarding-steps li:last-child {
margin-right: -1px;
}
.onboarding-steps li span {
display: block;
padding: 0 4px;
width: 15px;
height: 15px;
font-size: 10px;
background-color: white;
color: grey;
border-radius: 50%;
border: 1px solid grey;
}
.onboarding-steps li:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid #393D66;
position: absolute;
top: 50%;
margin-top: -20px;
left: 100%;
margin-left: -2px;
z-index: 2;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 20px solid transparent;
border-bottom: 20px solid transparent;
border-left: 20px solid white;
position: absolute;
top: 50%;
margin-top: -20px;
margin-left: -1px;
left: 100%;
z-index: 1;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li:last-child:after {
margin-left: -22px;
}
.onboarding-steps li:last-child:before {
margin-left: -21px;
border-top: 20px solid #ffffff;
border-bottom: 20px solid #ffffff;
}
.onboarding-steps li.active:last-child:before {
border-top: 20px solid #393D66;
border-bottom: 20px solid #393D66;
}
.onboarding-steps li.active ~ li {
background: #ffffff;
}
.onboarding-steps li.active ~ li:after {
border-left: 20px solid #ffffff;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li.active ~ li:before {
border-left: 20px solid grey;
transition: border-left 100ms linear 0s;
}
.onboarding-steps li.active:last-child:before {
content: "";
display: inline-block;
background: #393D66;
position: absolute;
right: 0;
top: 0;
width: 2500px;
height: 100%;
z-index: 1;
border-top: 0;
border-left: 0;
border-bottom: 0;
margin-top: 0;
transition: width 100ms linear 0s;
}
<div class="onboarding-container">
<div class="onboarding-container-inner">
<ul class="onboarding-steps">
<li class="list-item active">
<span>1</span>
</li>
<li class="list-item">
<span>2</span>
</li>
<li class="list-item">
<span>3</span>
</li>
<li class="list-item">
<span>4</span>
</li>
</ul>
</div>
</div>

Breadcrump with css

In this fiddle I create a simple breadcrumb. I like to change the dependencies of class "div.arrow-right". I like to control the arrow size by "#sequence". So that the size of the arrow belongs to the font-size. That means if I change the font-size the right-arrow should fit automatically the same high as the div which contains the writing.
#sequence {
font-size: 28px;
}
And I like to add a gap or lets say a white thin arrow between two breadcrumb elements, see the picture below.
An alternate using :before and :after pseudo elements. Fiddle
.breadcrumb {
list-style: none;
overflow: hidden;
font-size: 28px;
}
.breadcrumb li {
color: white;
text-decoration: none;
padding: 8px 0 8px 50px;
position: relative;
display: block;
float: left;
cursor: pointer;
}
.breadcrumb li:after {
content: "";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid #74c476;
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.breadcrumb li:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent;
border-bottom: 50px solid transparent;
border-left: 30px solid white;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 2px;
left: 100%;
z-index: 1;
}
li:nth-child(1) {
padding-left: 20px;
background-color: #74c476;
}
li:nth-child(2) {
background-color: #61a362;
}
li:nth-child(3) {
background-color: #518851;
}
li:nth-child(1):after {
border-left-color: #74c476;
}
li:nth-child(2):after {
border-left-color: #61a362;
}
li:nth-child(3):after {
border-left-color: #518851;
}
<ul class="breadcrumb">
<li>hello</li>
<li>operator</li>
<li>layout</li>
</ul>

How do I create triangle shaped vertical breadcrumbs

I'm trying to design a vertical breadcrumb. I'm not sure how to do the small triangles on the bottom, I'm hoping that I can do this with css only and not use images. I'm looking at getting the following results:
They should be able to fill with white color just like the element on hover.
You can see my progress on fiddle: http://jsfiddle.net/5jJm3/2/
HTML:
<ul>
<li><div class="link"><p>Link1</p></div></li>
<li><div class="link"><p>Link2</p></div></li>
<li><div class="link"><p>Link3</p></div></li>
<li><div class="link"><p>Link4</p></div></li>
</ul>
CSS:
ul {
width: 100px;
height:500px;
border: 1px solid red;
margin: 0;
padding: 0;
text-align: center;
background: #1c818a;
}
ul li {
width: 100px;
height: 100px;
background: #64c7c7;
color: white;
list-style-type: none;
border-bottom: 3px solid white;
position: relative;
}
ul li:hover {
cursor: pointer;
background: white;
color: #64c7c7;
}
.link {
width:100px;
height:100px;
position:absolute;
left:50%;
top:50%;
margin:-25px 0 0 -50px;
}
Thanks!
DEMO: http://jsbin.com/zexoq/1
http://jsbin.com/zexoq/2/edit -- better
Multi-line: http://jsbin.com/qebek/2/edit
<ol class="breadcrumbs">
<li>title</li>
<li>title</li>
<li>title</li>
<li>title</li>
</ol>
CSS
.breadcrumbs,
.breadcrumbs * {
box-sizing: border-box;
list-style: none;
margin: 0;
}
.breadcrumbs li { width: 100px }
.breadcrumbs a {
text-decoration: none;
display: block;
height: 100px;
width: 100%;
background: aqua;
text-align: center;
line-height: 105px;
position: relative;
overflow: visible;
}
.breadcrumbs li a { border-bottom: 2px solid #fff }
.breadcrumbs li:last-child { border-bottom: 10px solid blue }
.breadcrumbs li:not(:last-child) a:after {
content: '';
width: 0;
height: 0;
position: absolute;
z-index: 2;
bottom: -10px;
left: 50%;
margin-left: -10px;
border-style: solid;
border-width: 10px 10px 0 10px;
border-color: aqua transparent transparent transparent;
}
.breadcrumbs li:not(:last-child) a:before {
content: '';
width: 0;
height: 0;
position: absolute;
z-index: 1;
bottom: -13px;
left: 50%;
margin-left: -12px;
border-style: solid;
border-width: 12px 12px 0 12px;
border-color: #fff transparent transparent transparent;
}
.breadcrumbs li:hover a {
background:#fff;
}
.breadcrumbs li:hover a:after {
border-top-color:#fff;
}
You can use :before and :after to create the triangle with borders.
Check my code:
ul{
text-align: center;
background: #1c818a;
width:200px;
padding:0;
margin:0;
height:900px;
}
li{
list-style-type: none; margin:0; margin-bottom:-2px;
}
p{margin-top:50px; color:white; font-size:20px;}
.arrow_box {
position: relative;
background: #66c7c5;
border: 2px solid #FFF;
border-left:0;
width:200px;
height:200px;
}
.arrow_box:hover {
background: #FFF;
}
.arrow_box:hover > p{
color: #66c7c5;
}
.normal_box {
position: relative;
background: #66c7c5;
border: 2px solid #FFF;
border-left:0;
width:200px;
height:200px;
}
.normal_box:hover {
background: #FFF;
}
.normal_box:hover > p{
color: #66c7c5;
}
.arrow_box:hover:after{
border-color: rgba(255, 255, 255, 0);
border-top-color: #FFF;
}
.arrow_box:after, .arrow_box:before {
top: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
}
.arrow_box:after {
border-color: rgba(102, 199, 197, 0);
border-top-color: #66c7c5;
border-width: 30px;
margin-left: -30px;
}
.arrow_box:before {
border-color: rgba(255, 255, 255, 0);
border-top-color: #FFF;
border-width: 33px;
margin-left: -33px;
}
.arrow_box:nth-of-type(1):before,.arrow_box:nth-of-type(1):after{z-index:4;}
.arrow_box:nth-of-type(2):before,.arrow_box:nth-of-type(2):after{z-index:3;}
.arrow_box:nth-of-type(3):before,.arrow_box:nth-of-type(3):after{z-index:2;}
DEMO: http://jsfiddle.net/4n9hq/