How to Use a href link in Tailwind CSS

In this tutorial, we will explore how to style anchor (<a>) links using Tailwind CSS. We will cover creating custom link styles, text decoration, adding underlines and hover effects, and creating link buttons.

Tailwind CSS <a> href link Example

In Tailwind CSS, you can create simple links using the text-blue-{size} class for color and the underline class for adding underlines.

<a href="#" class="text-blue-300 underline">Tailwind CSS a href Link</a>
<a href="#" class="text-blue-400 underline">Tailwind CSS a href Link</a>
<a href="#" class="text-blue-500 underline">Tailwind CSS a href Link</a>
<a href="#" class="text-blue-600 underline">Tailwind CSS a href Link</a>
<a href="#" class="text-blue-700 underline">Tailwind CSS a href Link</a>
<a href="#" class="text-blue-800 underline">Tailwind CSS a href Link</a>
a href link with underline

You can also apply different text decoration styles, such as red, green, blue, and purple.

<a href="#" class="text-blue-500 underline">Tailwind CSS a href Link with color</a>
<a href="#" class="text-red-500 underline">Tailwind CSS a href Link with color</a>
<a href="#" class="text-green-500 underline">Tailwind CSS a href Link with color</a>
<a href="#" class="text-purple-500 underline">Tailwind CSS a href Link with color</a>
a link with colors

Tailwind CSS a href with hover effect.

<a href="#" class="text-blue-500 underline hover:text-blue-700">Tailwind CSS a href Link with hover</a>

Show under only hover state.

<a href="#" class="text-blue-500 no-underline hover:underline hover:text-blue-700">Tailwind CSS a href Link</a>
hover state.

Tailwind CSS a link with button.

<a href="#"
    class="px-4 py-2 text-blue-100 no-underline bg-blue-500 rounded hover:bg-blue-600 hover:underline hover:text-blue-200">Link
    Button</a>
link with button
saim ansari
saim ansari

I'm Saim Ansari, a full-stack developer with 4+ years of hands-on experience who thrives on building web applications that leave a lasting impression. When it comes to tech, I'm particularly adept at Laravel, React, Tailwind CSS, and the Tall Stack