Skip to content

Instantly share code, notes, and snippets.

@pangyuteng
Last active January 29, 2024 22:50
Show Gist options
  • Save pangyuteng/97373400dcb70812359d8f7697c2c78a to your computer and use it in GitHub Desktop.
Save pangyuteng/97373400dcb70812359d8f7697c2c78a to your computer and use it in GitHub Desktop.
super simple workflow rendering with css and bootstrap

sample view of demo.html

demo

<!--
ref
https://www.reddit.com/r/webdev/comments/uw0a5a/comment/i9ouqod
https://getbootstrap.com/docs/5.0/components/spinners
-->
<!doctype html>
<html lang="en" data-bs-theme="dark">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<style>
.workflow {
max-width: 640px;
margin: 2rem auto;
display: flex;
align-items: flex-start;
justify-content: center;
text-align: center;
margin: 20px;
}
.step {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
&:not(:last-of-type) {
margin-right: 2rem;
}
}
.wrap {
text-align: center;
margin: 20px;
position: relative;
}
.links {
padding: 0 10px;
display: flex;
justify-content: space-between;
position: relative;
}
.wrap:before {
content: '';
position: absolute;
top: 25%;
left: 0;
border-top: 5px solid black;
background: black;
width: 100%;
transform: translateY(-50%);
}
</style>
</head>
<body>
<div class="workflow wrap">
<div class="links">
<div class="step step1">
<div class="icon">
<i class="bi bi-exclamation-circle-fill" style = "color:red;"></i>
</div>
<div class="text">error</div>
</div>
<div class="step step2">
<div class="icon">
<i class="bi bi-check-circle-fill" style="color:green;"></i>
</div>
<div class="text">done</div>
</div>
<div class="step step4">
<div class="icon">
<div class="spinner-grow spinner-grow-sm" role="status" style="color:gray;"></div>
</div>
<div class="text">in-progress</div>
</div>
<div class="step step3">
<div class="icon"><i class="bi bi-circle-fill" style="color:gray;"></i></div>
<div class="text">pending</div>
</div>
</div>
</body>
</html>