content
Tailwind CSS Divider
A divider is employed to separate content either vertically or horizontally.
Utilize the component class divider
to create vertical content divisions. Apply the modifier class divider-{semantic-color}
to specify different colors for the dividers.
<div class="divider"></div>
<div class="divider divider-neutral"></div>
<div class="divider divider-primary"></div>
<div class="divider divider-secondary"></div>
<div class="divider divider-accent"></div>
<div class="divider divider-info"></div>
<div class="divider divider-success"></div>
<div class="divider divider-warning"></div>
<div class="divider divider-error"></div>
Use the responsive class divider-horizontal
with the component class divider
to create horizontal content divisions.
<div class="flex h-60 flex-wrap gap-8">
<div class="divider divider-horizontal"></div>
<div class="divider divider-horizontal divider-neutral"></div>
<div class="divider divider-horizontal divider-primary"></div>
<div class="divider divider-horizontal divider-secondary"></div>
<div class="divider divider-horizontal divider-accent"></div>
<div class="divider divider-horizontal divider-info"></div>
<div class="divider divider-horizontal divider-success"></div>
<div class="divider divider-horizontal divider-warning"></div>
<div class="divider divider-horizontal divider-error"></div>
</div>
Add text or icon within the divider markup to show it within the horizontal divider line.
<div class="flex h-60 flex-wrap gap-5">
<div class="divider divider-horizontal">Text</div>
<div class="divider divider-horizontal"><span class="flex items-center justify-center"><span class="icon-[tabler--sun] size-5"></span></span> </div>
</div>
Insert icons or text into the divider markup following the examples below to display them within the divider line.
<div class="divider">Text</div>
<div class="divider"><span class="flex items-center justify-center"><span class="icon-[tabler--crown] size-5"></span></span></div>
The following example represents the default style for the divider line.
<div class="divider">Default</div>
Apply the modifier class divider-dotted
to display the divider line in a dotted pattern.
<div class="divider divider-dotted">Dotted</div>
Apply the modifier class divider-dashed
to display the divider line in a dashed pattern.
<div class="divider divider-dashed">Dashed</div>
Utilize the TailwindCSS state classes after:
and before:
along with the border classes border-e-*
for vertical dividers and border-t-*
for horizontal dividers to customize their thickness.
<div class="divider after:border-t-2 before:border-t-2">Default</div>
<div class="divider divider-dotted after:border-t-4 before:border-t-4">Dotted</div>
<div class="divider divider-dashed after:border-t-8 before:border-t-8">Dashed</div>
Use the responsive classes divider-start
and divider-end
to position content at the start and end positions, respectively. By default, the content is centered.
<div class="divider divider-start">Start</div>
<div class="divider">Center</div>
<div class="divider divider-end">End</div>
Use the responsive classes divider-start
and divider-end
to position content at the start and end positions in horizontal divider, respectively. By default, the content is centered.
<div class="flex h-60 gap-5">
<div class="divider divider-start divider-horizontal">Start</div>
<div class="divider divider-horizontal">Center</div>
<div class="divider divider-end divider-horizontal">End</div>
</div>
The responsive dividers adapt according to breakpoints.
Use TailwindCSS classes for responsive design, such as sm:
, md:
, lg:
, xl:
, and 2xl:
, along with the responsive class divider-horizontal
, to switch the divider alignment to horizontal at specific breakpoints.
<div class="flex w-full flex-col gap-5 lg:flex-row">
<div class="shadow-base-300/20 bg-base-200 grid h-32 grow place-items-center shadow-sm"></div>
<div class="divider lg:divider-horizontal">OR</div>
<div class="shadow-base-300/20 bg-base-200 grid h-32 grow place-items-center shadow-sm"></div>
</div>
Utilize responsive breakpoint classes alongside the responsive class divider-vertical
to adjust the divider alignment to vertical at specific breakpoints.
<div class="flex w-full gap-5 lg:flex-col">
<div class="shadow-base-300/20 bg-base-200 grid h-32 grow place-items-center shadow-sm"></div>
<div class="divider divider-horizontal lg:divider-vertical">OR</div>
<div class="shadow-base-300/20 bg-base-200 grid h-32 grow place-items-center shadow-sm"></div>
</div>
Use the example below to implement buttons with a responsive horizontal divider.
<div class="flex w-fit flex-col gap-5 lg:flex-row">
<div class="grid grow place-items-center">
<button class="btn btn-soft [--btn-color:#1877F2] [--btn-fg:#1877F2]">
<span class="icon-[tabler--brand-facebook]"></span>
Sign in with Facebook
</button>
</div>
<div class="divider lg:divider-horizontal"></div>
<div class="grid grow place-items-center">
<button class="btn btn-soft [--btn-color:#1da1f2] [--btn-fg:#1da1f2]">
<span class="icon-[tabler--brand-x]"></span>
Sign in with Twitter
</button>
</div>
</div>
Use the example below to implement buttons with a vertical divider.
<div class="flex w-fit flex-col gap-5">
<div class="grid grow place-items-center">
<button class="btn btn-soft [--btn-color:#1877F2] [--btn-fg:#1877F2]">
<span class="icon-[tabler--brand-facebook]"></span>
Sign in with Facebook
</button>
</div>
<div class="divider divider-vertical"></div>
<div class="grid grow place-items-center">
<button class="btn btn-soft w-full [--btn-color:#1da1f2] [--btn-fg:#1da1f2]">
<span class="icon-[tabler--brand-x]"></span>
Sign in with Twitter
</button>
</div>
</div>