I am trying to generate a pure HTML/CSS menu with arrows pointing to the right. As long as the active state is the first tab everything looks fine (http://jsfiddle.net/q03wma6u/). But when the active class moves to the second tab, the border and the arrow are not positioned togehter (http://jsfiddle.net/q03wma6u/1/).
Is there a way to generate this menu just using HTML/CSS?
ol.tabs {
-moz-transition: opacity 0.3s linear;
-o-transition: opacity 0.3s linear;
-webkit-transition: opacity 0.3s linear;
transition: opacity 0.3s linear;
margin: 0;
padding: 0;
list-style: none;
display: table;
table-layout: fixed;
width: 100%;
}
ol.tabs li {
position: relative;
display: table-cell;
overflow: hidden;
margin: 0;
padding: 0;
text-align: center;
text-transform: uppercase;
background-color: #ccc;
-moz-transition: background-color 0.3s linear;
-o-transition: background-color 0.3s linear;
-webkit-transition: background-color 0.3s linear;
transition: background-color 0.3s linear;
}
ol.tabs li:after {
content: " ";
display: block;
position: absolute;
top: 4px;
right: 6px;
width: 32px;
height: 32px;
border: 1px solid #4a4a4a;
border-bottom: none;
border-left: none;
border-radius: 2px;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
ol.tabs li:last-child:after {
border: none;
}
ol.tabs li:last-child a:before {
border: none;
}
ol.tabs li.active a {
background-color: #fff;
-moz-transition: background-color 0.3s linear;
-o-transition: background-color 0.3s linear;
-webkit-transition: background-color 0.3s linear;
transition: background-color 0.3s linear;
}
ol.tabs li.active a:before {
content: " ";
display: block;
position: absolute;
top: 0px;
right: 0px;
width: 0px;
height: 0px;
border-style: solid;
border-width: 20px 0 20px 20px;
border-color: transparent transparent transparent #fff;
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
ol.tabs li.active a:after {
content: " ";
display: block;
position: absolute;
top: 0px;
left: 0px;
width: 0px;
height: 0px;
border-style: solid;
border-width: 20px 0 20px 20px;
border-color: transparent transparent transparent #ccc;
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
ol.tabs li:first-child a:after {
border: none;
}
ol.tabs li a {
display: block;
padding: 10px 0px;
margin-right: 20px;
color: #4a4a4a;
font-weight: bold;
text-decoration: underline;
}
ol.tabs li a.disabled {
cursor: initial;
font-weight: normal;
text-decoration: none;
}
ol.tabs li a.disabled:hover {
text-decoration: none;
}
<ol class="tabs">
<li class="step1 active"><a href="#" data-next="step2" class="disabled">Step 1</a></li>
<li class="step2"><a href="#" data-next="step3" class="disabled">Step 2</a></li>
<li class="step3"><a href="#" data-next="ste4" class="disabled">Step 3</a></li>
<li class="step4"><a href="#" data-next="step5" class="disabled">Step 4</a></li>
</ol>