Introduction
Line height controls the space between lines of text. It makes reading easier and the text look neat.
Jump into concepts and practice - no test required
Line height controls the space between lines of text. It makes reading easier and the text look neat.
leading-{size}
// Example sizes: leading-none, leading-tight, leading-snug, leading-normal, leading-relaxed, leading-looseUse leading- classes to set line height in Tailwind CSS.
Sizes range from very tight to very loose spacing.
leading-none sets line height to 1, so lines are very close.<p class="leading-none">This text has no extra space between lines.</p>leading-relaxed adds more space between lines for comfort.<p class="leading-relaxed">This text has relaxed line height for easier reading.</p>leading-loose creates a very open look with big gaps.<p class="leading-loose">This text has loose line height, with lots of space between lines.</p>This page shows three paragraphs with different Tailwind line height classes. Borders help you see the spacing clearly.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Tailwind Line Height Example</title> <script src="https://cdn.tailwindcss.com"></script> </head> <body class="p-6"> <section> <h2 class="text-xl font-bold mb-2">Line Height Examples</h2> <p class="leading-none border p-2 mb-4">This paragraph uses <strong>leading-none</strong>. Lines are very close together, making the text look tight.</p> <p class="leading-normal border p-2 mb-4">This paragraph uses <strong>leading-normal</strong>. It has a comfortable default line height for reading.</p> <p class="leading-loose border p-2">This paragraph uses <strong>leading-loose</strong>. Lines have extra space, making the text airy and open.</p> </section> </body> </html>
Line height affects how easy text is to read, especially on small screens.
Use Tailwind's leading- classes to quickly adjust spacing without custom CSS.
Combine line height with font size for best results.
Line height controls space between lines of text.
Tailwind uses leading- classes to set line height easily.
Adjust line height to improve readability and style.
leading-relaxed control in a text block?leading- classesleading- classes set the line height, which is the vertical space between lines of text.leading-relaxed doesleading-relaxed increases the line height to make text more spaced out and easier to read.leading-5 corresponds to 1.25 line height, which is 20px if the font size is 16px.leading-6 is 1.5, leading-4 is 1, and leading-7 is 1.75, so only leading-5 matches 1.25.<p class="leading-tight">This is a line of text.</p> <p class="leading-loose">This is another line of text.</p>
leading-tight and leading-looseleading-tight sets a smaller line height (less space), while leading-loose sets a larger line height (more space).<p class="leading-10">Sample text</p>
leading-10 is a valid Tailwind class setting line-height to 2.5rem.leading-10 does not existmd: apply at medium screen sizes and above.leading-normal md:leading-relaxed fits.