Open In App

What Classes can be used for Text alignment and Styling in Tailwind CSS ?

Last Updated : 16 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

In Tailwind CSS, various utility classes are available for text alignment and styling. Here are some commonly used classes:

Text Alignment:

Adjust the horizontal alignment of text using classes like text-left, text-center, text-right, or text-justify.

  • text-left: Aligns text to the left.
  • text-center: Centers text.
  • text-right: Aligns text to the right.
  • text-justify: Justifies text.

Font Weight:

Font Weight controls the thickness of the font with classes like font-thin, font-normal, font-bold, or font-black.

CSS Property Description
font-thin Sets text to thin font weight.
font-normal Sets the text to normal font weight.
font-semibold Sets text to semi-bold font-weight.
font-bold Sets text to bold font weight.
font-extra bold Sets text to extra bold font weight.
font-black Sets text to black font-weight.

Text Size:

Set the size of text with classes like text-xs (extra small), text-lg (large), or text-2xl (even larger).

CSS Class Description
text-xs Sets text to extra-small size.
text-sm Sets the text to a small size.
text-base Sets the text to base size.
text-lg Sets text to large size.
text-xl Sets text to extra-large size.

text-2xl, text-3xl, etc.

Additional size classes.

Text Color:

Define the color of text using classes like text-red-500, text-green-700, or other color variants.

  • text-[color]: Applies a specific text color, where [color] is a color name or value.

Italic and Underline:

Add emphasis to text with classes like italic italics and underline underlining.

  • italic: Makes text italic.
  • underline: Underlines text.

Text Decoration:

Apply various text decorations using classes like line-through for strikethrough or no-underline to remove underlining.

  • no-underline: Removes underlining from text.

Letter Spacing:

Adjust the spacing between letters using classes like tracking-tighter, tracking-normal, or tracking-wider.

  • tracking-tight: Sets tight letter spacing.
  • tracking-normal: Sets normal letter spacing.
  • tracking-wide: Sets wide letter spacing.

Line Height:

It sets the height of a line of text.

  • leading-tight: Sets tight line height.
  • leading-normal: Sets normal line height.
  • leading-loose: Sets loose line height.

Text Transform:

Change the capitalization of text with classes like uppercase, lowercase, or capitalize.

  • uppercase: Transforms text to uppercase.
  • lowercase: Transforms text to lowercase.
  • capitalize: Capitalizes the first letter of each word.

Similar Reads

Tailwind CSS Text Alignment
This class accepts lots of values in tailwind CSS in which all the properties are covered in class form. It is the alternative to the CSS text-align property. This class is used to specify the horizontal alignment of text in an element. Text Alignment classes: text-lefttext-centertext-righttext-justify text-left: It is used to set the text-alignmen
2 min read
What Classes are commonly used for Card Components in Tailwind CSS ?
In Tailwind CSS, Commonly used classes for card components include "bg-white" for the card background, "p-4" for padding, "rounded-md" for rounded corners, and "shadow-md" for a subtle shadow effect. These classes provide a quick and responsive way to style card elements in a Tailwind CSS project. Trivial Card Component Classesbg-[color] Sets the b
2 min read
Tailwind CSS 3 Classes doesn't Override Previous Classes
Tailwind CSS is basically a Utility-first CSS framework for building rapid custom UI. It is a highly customizable, low-level CSS framework that gives you all of the building blocks that you need. Also, it is a cool way to write inline styling and achieve an awesome interface without writing a single line of your own CSS. Syntax<div class="bg-blu
2 min read
Tailwind CSS Vertical Alignment
This class accepts more than one value in tailwind CSS. All the properties are covered in class form. It is the alternative to the CSS vertical-align property. This class is used to specify the vertical alignment of the table-box or inline element. Vertical Alignment classes: align-baseline: It aligns the element baseline corresponding to the basel
2 min read
Tailwind CSS Alignment Complete Reference
Tailwind CSS is basically a utility first CSS framework for rapid custom UI. Tailwind CSS Alignment controls how the flex and grid items are aligned along with the container for fast front-end development. suppose Tailwind CSS Justify Content controlling how flex and grid items are positioned along a container's main axis and Justify items controll
2 min read
Can I Create Masonry Layout using Tailwind CSS Utility Classes ?
Yes, you can create a Masonry layout using Tailwind CSS utility classes. A Masonry layout is a popular design pattern used for displaying images or other elements in a grid-like structure where each item is of varying height and width. This layout creates a visually appealing and dynamic design that helps to break the monotony of a traditional grid
3 min read
Foundation CSS Typography Helpers Text Alignment
Foundation CSS is an open-source & responsive front-end framework built by ZURB foundation in September 2011, that makes it easy to design beautiful responsive websites, apps, and emails to look amazing & can be accessible to any device. It is used by many companies such as Facebook, eBay, Mozilla, Adobe, and even Disney. The framework is b
3 min read
Primer CSS Typography Text Alignment
Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, an
2 min read
Primer CSS Typography Responsive Text Alignment
Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by object-oriented CSS principles, functional CSS, an
2 min read
Which inline attribute is used to specify the styling of specific elements in HTML ?
In this article, we will discuss the inline attribute used to specify the styling of specific elements in HTML. Styles in HTML are basically rules that describe how a document will be presented in a browser. Style information can be either attached as a separate document or embedded in the HTML document. Inline Style: In Inline styling, the CSS rul
1 min read