Tailwind CSS Divider Line Example

In this section we will create tailwind divider line, tailwind v3 vertical line, tailwindcss horizontal line, tailwind css custom divide line example with Tailwind CSS.


Example 1

Tailwind CSS custom divider line using padding p-{size}.

<span class="w-full p-0.5 bg-red-600 lg:w-1/3"></span>
<span class="w-full p-0.5 bg-green-600 lg:w-1/3"></span>
<span class="w-full p-0.5 bg-green-600 lg:w-1/3"></span>
<span class="w-full p-0.5 bg-purple-600 lg:w-1/3"></span>

Tailwind CSS custom divider line using height class h-{size}.

<span class="h-1 w-full bg-red-600 lg:w-1/3"></span>
<span class="h-1 w-full bg-green-600 lg:w-1/3"></span>
<span class="h-1 w-full bg-green-600 lg:w-1/3"></span>
<span class="h-1 w-full bg-purple-600 lg:w-1/3"></span>


tailwind divide

tailwind divide

Example 2

Tailwind CSS vertical line hr tag style divide.

<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Tailwind CSS 3 Divider</title>
        <script src="https://cdn.tailwindcss.com"></script>
    </head>

    <body>
        <div class="grid max-w-sm grid-cols-1 mx-auto text-center divide-y shadow-md">
            <div class="p-4 text-white bg-purple-600">Line 01</div>
            <div class="p-4 text-white bg-purple-600">Line 02</div>
            <div class="p-4 text-white bg-purple-600">Line 03</div>
        </div>
    </body>

</html>
tailwind css  divider vertical line

tailwind css divider vertical line


Example 3

Tailwind CSS divide-x for horizontal line.

<div class="grid max-w-sm grid-cols-3 mx-auto text-center divide-x shadow-md">
  <div class="p-4 text-white bg-purple-600">Line 01</div>
  <div class="p-4 text-white bg-purple-600">Line 02</div>
  <div class="p-4 text-white bg-purple-600">Line 03</div>
</div>
tailwind horizontal line

tailwind horizontal line


Example 4

tailwind css divide with style & bold border.

<div class="grid max-w-sm grid-cols-1 mx-auto text-center divide-y-4 divide-red-600 shadow-md divide-dashed">
  <div class="p-4 text-white bg-purple-600">Line 01</div>
  <div class="p-4 text-white bg-purple-600">Line 02</div>
  <div class="p-4 text-white bg-purple-600">Line 03</div>
</div>