← Back toCSS layout

Wizard

Written byPhuoc Nguyen
Created
22 Nov, 2019
Category
Navigation

HTML

index.html
<div class="wizard">
<!-- Step -->
<div class="wizard__step">
<div class="wizard__dot">
<!-- The left connector -->
<div class="wizard__connector"></div>

<!-- The step number -->
<div class="wizard__number">...</div>

<!-- The right connector -->
<div class="wizard__connector"></div>
</div>

<!-- Title of step -->
...
</div>

<!-- Repeat other steps -->
...
</div>

CSS

styles.css
.wizard {
display: flex;
}

.wizard__step {
/* Make all steps have the same width */
flex: 1;
}

.wizard__dot {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
}

.wizard__connector {
flex: 1;
height: 1px;
background-color: #d1d5db;
}

.wizard__step:first-child .wizard__connector:first-child,
.wizard__step:last-child .wizard__connector:last-child {
background-color: transparent;
}

.wizard__number {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;

/* Rounded border */
background-color: #d1d5db;
border-radius: 9999px;
height: 2rem;
width: 2rem;

/* OPTIONAL: Spacing between it and connectors */
margin-left: 0.25rem;
margin-right: 0.25rem;
}
If you found this post helpful, please consider giving the repository a star on GitHub or sharing the post on your favorite social networks 😍. Your support would mean a lot to me!

Questions? 🙋

Do you have any questions about front-end development? If so, feel free to create a new issue on GitHub using the button below. I'm happy to help with any topic you'd like to learn more about, even beyond what's covered in this post.
While I have a long list of upcoming topics, I'm always eager to prioritize your questions and ideas for future content. Let's learn and grow together! Sharing knowledge is the best way to elevate ourselves 🥷.
Ask me questions

Recent posts ⚡

Newsletter 🔔

If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn