Step by step building the Step Progress Bar with CSS – Part 2

Tram Ho

Hello everyone, it’s me again ? . In this article I continue to give you another way to replace the disadvantages of float + width mentioned above. is to use the table , so how to do it, let’s find out through this article.

Steps to take

Step 1: Create the HTML structure

The HTML structure is still no different

Step 2: Style the ul and li tags

Here I will turn the ul tag into a “table” using display: table + width: 100% and an important attribute which is table-layout: fixed

And for li have equal width in the table , we need to add display: table-cell

Step 3: Style for li:before

Style has not changed compared to the previous version

Step 4: Style for li:after

In this version I will no longer use negative left , but use positive values, which means it will clear the horizontal line of the last item

Step 5: Add specific styles for the active , complete states

The results we have obtained

Conclude

The use of table in this case is quite good, it helps us to divide the width of the items equally to help increase flexibility when there is a change in the number of steps.

If you find a good article, give me +1 upvote. If you like me, click the follow button for more cool stuff. Wish you success and see you in the following articles!

Share the news now

Source : Viblo