Underline on Hover [Left to Right + Right to Left] with Animation

Adding subtle yet captivating hover effects to text can enhance the user experience on your website. In this blog post, we’ll delve into the creative world of Tailwind CSS to achieve a stylish underline on hover effect, both from left to right and right to left. Brace yourself for an engaging journey through the magic of Tailwind CSS!

Left to Right Underline on Hover

Let’s start with the left-to-right animation. The key to achieving this effect lies in the strategic use of Tailwind CSS classes. Take a look at the code snippet below:

In this snippet, which you can try yourself on tailwindcss playground, we use the bg-left-bottom class to set the starting point on the left, and bg-gradient-to-r ensures a smooth gradient from left to right. The magic happens with the group-hover class, which triggers the animation from 0% to 100% on hover. Adjust the duration and ease to tailor the animation to your liking.

Right to Left Underline on Hover

Now, let’s explore the right-to-left animation. Similar to the previous example, we employ Tailwind CSS classes strategically for a seamless effect. Check the code given below and verify the working example online.

In this snippet written above, the bg-right-bottom class sets the starting point on the right and bg-gradient-to-l ensures a smooth gradient from right to left. The group-hover class once again adds the interactive touch, making the underline appear on hover.


Tailwind CSS empowers developers to create visually appealing and interactive designs with ease. The combination of gradient color classes, hover effects, and transitions showcased in this blog post allows you to add a touch of elegance to your text elements. Experiment with different colors, durations, and easings to find the perfect fit for your website. By harnessing the power of Tailwind CSS, you can make your website not only functional but also a delight to explore. Elevate your design game with these simple yet impactful underline effects!

Latest articles

Related articles