JSFiddle - React, Tailwind, and code Playground
by Ting-Yuan Chang
HTML
<div id="checkoutContainer">
<span class="flag pass">
<span class="fill"></span>
<span class="text"><span>1</span></span>
<span class="text desc">寄送及付款方式</span>
</span>
<span class="flag pass current">
<span class="fill"></span>
<span class="text"><span>2</span></span>
<span class="text desc">聯絡人資訊</span>
</span>
<span class="flag">
<span class="fill"></span>
<span class="text"><span>3</span></span>
<span class="text desc">確認資訊</span>
</span>
<span class="flag">
<span class="fill"></span>
<span class="text"><span>4</span></span>
<span class="text desc">完成訂購</span>
</span>
</div>
CSS
body {
background: white;
}
#checkoutContainer {
width: 830px;
margin: auto;
font-size: 0;
}
.flag {
display: inline-block;
width: 200px;
height: 30px;
position: relative;
margin-right: 5px;
opacity: 0.6;
background: #665857;
color: #665857;
}
.flag:nth-child(1) {
z-index: 4;
}
.flag:nth-child(1):after {
position: absolute;
left: 100%;
content: "";
border: solid 15px transparent;
border-left: solid 15px #665857;
}
.flag:nth-child(2) {
z-index: 3;
}
.flag:nth-child(2):before {
position: absolute;
left: 0;
content: "";
border: solid 15px transparent;
border-left: solid 15px white;
}
.flag:nth-child(2):after {
position: absolute;
left: 100%;
content: "";
border: solid 15px transparent;
border-left: solid 15px #665857;
}
.flag:nth-child(3) {
z-index: 2;
}
.flag:nth-child(3):before {
position: absolute;
left: 0;
content: "";
border: solid 15px transparent;
border-left: solid 15px white;
}
.flag:nth-child(3):after {
position: absolute;
left: 100%;
content: "";
border: solid 15px transparent;
border-left: solid 15px #665857;
}
.flag:nth-child(4) {
width: 215px;
margin-right: 0px;
z-index: 1;
}
.flag:nth-child(4):before {
position: absolute;
left: 0;
content: "";
border: solid 15px transparent;
border-left: solid 15px white;
}
.fill {
background: white;
position: absolute;
display: inline-block;
top: 1px;
right: 1px;
bottom: 1px;
left: 31px;
}
.fill:before {
position: absolute;
right: 100%;
content: "";
border: solid 14px white;
border-left: solid 14px transparent;
z-index: 1;
}
.fill:after {
position: absolute;
left: 100%;
content: "";
border: solid 14px transparent;
border-left: solid 14px white;
z-index: 1;
}
.flag:nth-child(1) .fill {
left: 29px;
}
.flag:nth-child(1) .fill:before {
border: solid 14px white;
}
.flag:nth-child(4) .fill {
right: 1px;
}
.flag:nth-child(4) .fill:after {
border: solid 14px...