JSFiddle - React, Tailwind, and code Playground
by Ting-Yuan Chang
HTML
<div id="checkoutContainer">
<span class="flag">
<span class="fill"></span>
<span class="text">1</span>
<span class="text desc">寄送及付款方式</span>
</span><span class="flag">
<span class="fill"></span>
<span class="text">2</span>
<span class="text desc">聯絡人資訊</span>
</span><span class="flag">
<span class="fill"></span>
<span class="text">3</span>
<span class="text desc">確認資訊</span>
</span><span class="flag">
<span class="fill"></span>
<span class="text">4</span>
<span class="text desc">完成訂購</span>
</span>
</div>
CSS
body {
background: white;
}
#checkoutContainer {
width: 830px;
margin: auto;
}
.flag {
display: inline-block;
width: 200px;
height: 30px;
position: relative;
margin-right: 5px;
}
.flag:nth-child(1) {
background: pink;
z-index: 4;
}
.flag:nth-child(1):after {
position: absolute;
left: 100%;
content: "";
border: solid 15px transparent;
border-left: solid 15px pink;
}
.flag:nth-child(2) {
background: lightblue;
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 lightblue;
}
.flag:nth-child(3) {
background: black;
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 black;
}
.flag:nth-child(4) {
background: gray;
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: 2px;
right: 1px;
bottom: 2px;
left: 31px;
}
.fill:before {
position: absolute;
right: 100%;
content: "";
border: solid 13px white;
border-left: solid 13px transparent;
z-index: 1;
}
.fill:after {
position: absolute;
left: 100%;
content: "";
border: solid 13px transparent;
border-left: solid 13px white;
z-index: 1;
}
.flag:nth-child(1) .fill {
left: 28px;
}
.flag:nth-child(1) .fill:before {
border: solid 13px white;
}
.flag:nth-child(4) .fill {
right: 2px;
}
.flag:nth-child(4) .fill:after {
border: solid 13px...