Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Font Family Size Weight in TailwindCSS

Font Family Size Weight in TailwindCSS

? Font Family, Size, and Weight Utilities in Tailwind CSS

Tailwind offers straightforward utilities to control the typography of your text — including font family, font size, and font weight.


1. Font Family (font-*)

Tailwind provides some default font family utilities, and you can customize more in your tailwind.config.js.

ClassCSS EquivalentDescription
font-sansfont-family: system-ui, ...Sans-serif font family (default)
font-seriffont-family: serif;Serif font family
font-monofont-family: monospace;Monospace font family

Example:

<p class="font-sans">This uses sans-serif font.</p><p class="font-serif">This uses serif font.</p><p class="font-mono">This uses monospace font.</p>

2. Font Size (text-*)

Controls the size of the text using a scale mapped to rem units.

ClassCSS EquivalentApproximate px Size
text-xsfont-size: 0.75rem12px
text-smfont-size: 0.875rem14px
text-basefont-size: 1rem16px (default)
text-lgfont-size: 1.125rem18px
text-xlfont-size: 1.25rem20px
text-2xlfont-size: 1.5rem24px
text-3xlfont-size: 1.875rem30px
text-4xlfont-size: 2.25rem36px
text-5xlfont-size: 3rem48px
text-6xlfont-size: 3.75rem60px
text-7xlfont-size: 4.5rem72px
text-8xlfont-size: 6rem96px
text-9xlfont-size: 8rem128px

Example:

<h1 class="text-4xl font-bold">Big Heading</h1><p class="text-base">Normal paragraph text</p>

3. Font Weight (font-*)

Control the thickness of the font.

ClassCSS EquivalentDescription
font-thinfont-weight: 100;Thin
font-extralightfont-weight: 200;Extra Light
font-lightfont-weight: 300;Light
font-normalfont-weight: 400;Normal (default)
font-mediumfont-weight: 500;Medium
font-semiboldfont-weight: 600;Semi-bold
font-boldfont-weight: 700;Bold
font-extraboldfont-weight: 800;Extra Bold
font-blackfont-weight: 900;Black (heaviest)

Example:

<p class="font-light">Light text</p><p class="font-bold">Bold text</p>

Summary Example

<div class="font-serif text-xl font-semibold">  This is serif font, size 1.25rem, semi-bold.</div>

If you want, I can also explain how to customize fonts or sizes in the Tailwind config!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql