Tailwind Font Weight

Tailwind Font weight is an important aspect of typography, as it helps to convey the tone and style of the content being presented.

The weight of a font refers to how thick or thin the strokes of each character are, with lighter weights appearing thinner and heavier weights appearing bolder.

Tailwind Font Weight

Tailwind font-weight enables you to set the thickness or weight of text in your HTML elements.

This class works by assigning a numerical value to the font weight property, ranging from 100 (thin) to 900 (bold), as an alternative to the CSS font-weight property. However, the font-weight applied depends on the font-family used in the browser. Some font families are available only in specific weights.



Tailwind Font Weight Classes

ClassesOverview
font-thinThe font weight of an element is set to 100, which is the thinnest available weight.
font-extralightA numerical value of 200 is applied to the font weight property of an element, resulting in very thin and light text.
font-lightUsing this class, you can set the font weight of an element to 300, a lighter weight than the default.
font-normalAn element’s font weight property is set to its normal value, which is 400 by default.
font-mediumThe font-weight property of the element using this class is set to 500, which is considered to be a standard medium weight.
font-semiboldUsed to apply a semi-bold font weight to an element. With a font weight of 600, it falls between font-normal (400) and font-bold (700).
font-boldBy setting the font weight to 700, the “font-bold” class makes the text within the element appear bold.
font-extraboldTailwind CSS sets an HTML element’s font weight to 800 with the font-extrabold class.
font-blackThe “font-black” class in Tailwind CSS sets the font weight of an HTML element to the boldest possible value of 900.

Syntax

<element class="font-normal">...</element>

The following example illustrates how to use Tailwind font weight classes:

Example: 

<!DOCTYPE html> <html><head> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="text-center mx-4 space-y-2"> <h1 class="text-gray-600 text-2xl font-semibold"> MrExamples </h1> <p class="font-semibold my-4">Font Weight Class in Tailwind CSS</p> <div class="mx-24 bg-gray-200 p-2 rounded"> <p class="p-2 text-justify flex justify-evenly">font-thin: <span class="font-thin"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-light: <span class="font-light"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-medium: <span class="font-medium"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-bold: <span class="font-bold"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-black: <span class="font-black"> Learning through examples </span> </p> </div> </body> </html>
This example demonstrates how you can utilize the remaining font-weight classes offered by Tailwind CSS:

Example: 

<!DOCTYPE html> <html><head> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="text-center mx-4 space-y-2"> <h1 class="text-gray-600 text-2xl font-semibold"> MrExamples </h1> <p class="font-semibold my-4">Font Weight Class in Tailwind CSS</p> <div class="mx-24 bg-gray-200 p-2 rounded"> <p class="p-2 text-justify flex justify-evenly">font-extralight: <span class="font-extralight"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-normal: <span class="font-normal"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-semibold: <span class="font-semibold"> Learning through examples </span> </p> <p class="p-2 text-justify flex justify-evenly">font-extrabold: <span class="font-extrabold"> Learning through examples </span> </p> </div> </body> </html>

The ability to easily adjust font weight is just one of the many ways that Tailwind makes it easy to create responsive and customizable user interfaces.

Whether you’re working on a small personal website or a large-scale web application, Tailwind font weight classes provide a powerful tool for creating visually appealing and effective typography.

We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *