Tailwind CSS Text Indent

The text-indent utility class in Tailwind CSS allows you to control the indentation of text within an element. With Tailwind's text-indent class, you can easily apply left indentation to paragraphs, lists, or any other text content.

Applying Text Indent

To apply text indentation to an element, you can use the indent-{value} utility class, where {value} represents the desired indentation value. The {value} can be a fixed number or a relative length. Here are some examples:

  • indent-0: No indentation (default).
  • indent-4: Indentation of 4 units (e.g., 1rem or 16px).
  • indent-8: Indentation of 2rem.
  • indent-16: Indentation of 4rem (64px).
html
<p class="indent-16">
Far away, on a secluded beach, the waves crashed against the shore, creating a soothing rhythm.
The sand, warm beneath my toes, embraced me like an old friend. Seagulls soared gracefully
overhead, their cries mingling with the laughter of children building sandcastles.
</p>

Preview

Far away, on a secluded beach, the waves crashed against the shore, creating a soothing rhythm. The sand, warm beneath my toes, embraced me like an old friend. Seagulls soared gracefully overhead, their cries mingling with the laughter of children building sandcastles.

Responsive Text Indent

Tailwind CSS allows you to apply text indentation classes responsively at different breakpoints. To use responsive text indentation classes, you can append the breakpoint prefix to the utility class. For example, md:indent-8 applies an indentation of 8 units starting from the medium breakpoint and above.

html
<p class="indent-4 md:indent-8">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>

In the above example, the paragraph has a left indentation of 4 units by default (text-indent-4), but starting from the medium breakpoint and above, the indentation is increased to 8 units (md:text-indent-8).

Tailwind Text Indent Class Table

ClassProperties
indent-0text-indent: 0px;
indent-pxtext-indent: 1px;
indent-0.5text-indent: 0.125rem; / 2px /
indent-1text-indent: 0.25rem; / 4px /
indent-1.5text-indent: 0.375rem; / 6px /
indent-2text-indent: 0.5rem; / 8px /
indent-2.5text-indent: 0.625rem; / 10px /
indent-3text-indent: 0.75rem; / 12px /
indent-3.5text-indent: 0.875rem; / 14px /
indent-4text-indent: 1rem; / 16px /
indent-5text-indent: 1.25rem; / 20px /
indent-6text-indent: 1.5rem; / 24px /
indent-7text-indent: 1.75rem; / 28px /
indent-8text-indent: 2rem; / 32px /
indent-9text-indent: 2.25rem; / 36px /
indent-10text-indent: 2.5rem; / 40px /
indent-11text-indent: 2.75rem; / 44px /
indent-12text-indent: 3rem; / 48px /
indent-14text-indent: 3.5rem; / 56px /
indent-16text-indent: 4rem; / 64px /
indent-20text-indent: 5rem; / 80px /
indent-24text-indent: 6rem; / 96px /
indent-28text-indent: 7rem; / 112px /
indent-32text-indent: 8rem; / 128px /
indent-36text-indent: 9rem; / 144px /
indent-40text-indent: 10rem; / 160px /
indent-44text-indent: 11rem; / 176px /
indent-48text-indent: 12rem; / 192px /
indent-52text-indent: 13rem; / 208px /
indent-56text-indent: 14rem; / 224px /
indent-60text-indent: 15rem; / 240px /
indent-64text-indent: 16rem; / 256px /
indent-72text-indent: 18rem; / 288px /
indent-80text-indent: 20rem; / 320px /
indent-96text-indent: 24rem; / 384px /

Windframe Tailwind blocks

Landing page

Build modern projects using Bootstrap 5 and Contrast

Trying to create components and pages for a web app or website from scratch while maintaining a modern User interface can be very tedious. This is why we created Contrast, to help drastically reduce the amount of time we spend doing that. so we can focus on building some other aspects of the project.

Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants. Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.

ad-banner