css实现环形流程图
效果图
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
:root {
/* 这个配置步骤之间的间距 */
--space: 20px;
/* 这个配置每行几个 */
--num: 4;
}
.row {
display: block;
margin-bottom: var(--space);
}
.row:nth-child(2n - 1) {
display: flex;
justify-content: flex-start;
}
.row:nth-child(2n) {
display: flex;
flex-direction: row-reverse;
}
.step {
width: calc((100% - var(--space) * (var(--num) - 1)) / var(--num));
height: 100px;
background-color: #f2f2f2;
border: 1px solid red;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.row:nth-child(2n - 1) > .step:not(:last-child):after {
content: "";
position: absolute;
top: 50%;
left: 100%;
transform: translateY(-50%);
border-top: 1px solid red;
width: var(--space);
}
.row:nth-child(2n - 1) > .step:not(:last-child) {
margin-right: var(--space);
}
.row:nth-child(2n - 1) > .step:last-child::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
border-right: 1px solid red;
height: var(--space);
}
.row:nth-child(2n) > .step:not(:last-child):after {
content: "";
position: absolute;
top: 50%;
right: 100%;
transform: translateY(-50%);
border-top: 1px solid red;
width: var(--space);
}
.row:nth-child(2n) > .step:not(:last-child) {
margin-left: var(--space);
}
.row:nth-child(2n) > .step:last-child::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
border-right: 1px solid red;
height: var(--space);
}
.row:last-child > .step:last-child::after {
content: none;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="step">Step 1</div>
<div class="step">Step 2</div>
<div class="step">Step 3</div>
<div class="step">Step 4</div>
</div>
<div class="row">
<div class="step">Step 5</div>
<div class="step">Step 6</div>
<div class="step">Step 7</div>
<div class="step">Step 8</div>
</div>
<div class="row">
<div class="step">Step 9</div>
<div class="step">Step 10</div>
<div class="step">Step 11</div>
<div class="step">Step 12</div>
</div>
<div class="row">
<div class="step">Step 13</div>
<div class="step">Step 14</div>
<div class="step">Step 15</div>
<div class="step">Step 16</div>
</div>
<div class="row">
<div class="step">Step 17</div>
<div class="step">Step 18</div>
<div class="step">Step 19</div>
</div>
</div>
</body>
</html>