1. Components
  2. Typography

Content

Tailwind CSS Typography

Documentation and examples for Preline UI typography, including global settings, headings, body text, lists, and more.

Preline uses Tailwind CSS utilities for controlling the typography system. When more control is needed, check out the Official Typography plugin.

Font family

Inter is the default font family used in Preline products. Learn more here for controlling and how to change it.

AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz

1234567890

:’;”<>?.,`\{}[]/!@#$%^&*()_+=

Headings

Default font sizes are not set by default. This example provides the heading font style with utility classes.

h1. Preline heading

h2. Preline heading

h3. Preline heading

h4. Preline heading

h5. Preline heading
h6. Preline heading
                
                  <h1 class="text-4xl dark:text-white">h1. Preline heading</h1>
                  <h2 class="text-3xl dark:text-white">h2. Preline heading</h2>
                  <h3 class="text-2xl dark:text-white">h3. Preline heading</h3>
                  <h4 class="text-xl dark:text-white">h4. Preline heading</h4>
                  <h5 class="text-lg dark:text-white">h5. Preline heading</h5>
                  <h6 class="text-base dark:text-white">h6. Preline heading</h6>
                
              

Inline text elements

Styling for common inline HTML5 elements.

You can use the mark tag to highlight text.

This line of text is meant to be treated as deleted text.

This line of text is meant to be treated as no longer accurate.

This line of text is meant to be treated as an addition to the document.

This line of text will render as underlined.

This line of text is meant to be treated as fine print.

This line rendered as bold text.

This line rendered as italicized text.

                
                  <p class="dark:text-white">You can use the mark tag to <mark>highlight</mark> text.</p>
                  <p class="dark:text-white"><del>This line of text is meant to be treated as deleted text.</del></p>
                  <p class="dark:text-white"><s>This line of text is meant to be treated as no longer accurate.</s></p>
                  <p class="dark:text-white"><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
                  <p class="dark:text-white"><u>This line of text will render as underlined.</u></p>
                  <p class="dark:text-white"><small>This line of text is meant to be treated as fine print.</small></p>
                  <p class="dark:text-white"><strong>This line rendered as bold text.</strong></p>
                  <p class="dark:text-white"><em>This line rendered as italicized text.</em></p>
                
              

Beware that those tags should be used for semantic purpose:

  • <mark> represents text which is marked or highlighted for reference or notation purposes.
  • <small> represents side-comments and small print, like copyright and legal text.
  • <s> represents element that are no longer relevant or no longer accurate.
  • <u> represents a span of inline text which should be rendered in a way that indicates that it has a non-textual annotation.

If you want to style your text, you should use the following classes instead:

  • .mark will apply the same styles as <mark>.
  • .small will apply the same styles as <small>.
  • .text-decoration-underline will apply the same styles as <u>.
  • .text-decoration-line-through will apply the same styles as <s>.

While not shown above, feel free to use <b> and <i> in HTML5. <b> is meant to highlight words or phrases without conveying additional importance, while <i> is mostly for voice, technical terms, etc.

Font sizes

Utilities for controlling the font size of an element.

Gradient text

Use bg-clip-text, color-transparent and bg-gradient-* classes to the text to add a gradient overlay to a text element.

This is a gradient text

                
                  <p class="bg-clip-text bg-gradient-to-tl from-blue-500 to-violet-500 text-transparent">
                    This is a gradient text
                  </p>
                
              

Blockquote

Heads up

Check out the extended blockquote component styles here.

Lists

Heads up

Check out the extended list component styles here.

Description list alignment

Align terms and descriptions horizontally by using utility classes. For longer terms, you can optionally add a .truncate class to truncate the text with an ellipsis.

Description lists
A description list is perfect for defining terms.
Term

Definition for the term.

And some more placeholder definition text.

Another term
This definition is short, so no extra paragraphs or anything.
Truncated term is truncated
This can be useful when space is tight. Adds an ellipsis at the end.
Nesting
Nested definition list
I heard you like definition lists. Let me put a definition list inside your definition list.
                
                  <dl class="grid sm:grid-cols-3 gap-1 sm:gap-3">
                    <dt class="sm:col-span-1 font-semibold dark:text-white">Description lists</dt>
                    <dd class="sm:col-span-2 mb-3 sm:mb-0 dark:text-white">A description list is perfect for defining terms.</dd>

                    <dt class="sm:col-span-1 font-semibold dark:text-white">Term</dt>
                    <dd class="sm:col-span-2 mb-3 sm:mb-0 dark:text-white">
                      <p>Definition for the term.</p>
                      <p>And some more placeholder definition text.</p>
                    </dd>

                    <dt class="sm:col-span-1 font-semibold dark:text-white">Another term</dt>
                    <dd class="sm:col-span-2 mb-3 sm:mb-0 dark:text-white">This definition is short, so no extra paragraphs or anything.</dd>

                    <dt class="sm:col-span-1 font-semibold truncate dark:text-white">Truncated term is truncated</dt>
                    <dd class="sm:col-span-2 mb-3 sm:mb-0 dark:text-white">This can be useful when space is tight. Adds an ellipsis at the end.</dd>

                    <dt class="sm:col-span-1 font-semibold dark:text-white">Nesting</dt>
                    <dd class="sm:col-span-2 mb-3 sm:mb-0 dark:text-white">
                      <dl class="grid sm:grid-cols-5 gap-1 sm:gap-3 dark:text-white">
                        <dt class="sm:col-span-2 font-semibold dark:text-white">Nested definition list</dt>
                        <dd class="sm:col-span-3 mb-3 sm:mb-0 dark:text-white">I heard you like definition lists. Let me put a definition list inside your definition list.</dd>
                      </dl>
                    </dd>
                  </dl>
                
              

Responsive font size

To style an element at a specific breakpoint, use responsive modifiers like md and lg.

For example, this will render small .text-sm size on mobile, default .text-base size on medium-width screens, and large .text-lg on large-width screens:

                
                  <p class="text-sm md:text-base lg:text-lg">
                    ...
                  </p>
                
              

Check out the Responsive Design documentation for an in-depth look at how these features work.

First-line and first-letter

Style the first line in a block of content using the first-line modifier, and the first letter using the first-letter modifier:

Well, let me tell you something, funny boy. Y'know that little stamp, the one that says "New York Public Library"? Well that may not mean anything to you, but that means a lot to me. One whole hell of a lot.

Sure, go ahead, laugh if you want to. I've seen your type before: Flashy, making the scene, flaunting convention. Yeah, I know what you're thinking. What's this guy making such a big stink about old library books? Well, let me give you a hint, junior.

                
                  <p class="first-line:uppercase first-line:tracking-widest
                    first-letter:text-7xl first-letter:font-bold first-letter:text-gray-900
                    first-letter:mr-3 first-letter:float-left
                  ">
                    Well, let me tell you something, funny boy. Y'know that little stamp, the one
                    that says "New York Public Library"? Well that may not mean anything to you,
                    but that means a lot to me. One whole hell of a lot.
                  </p>
                
              

Open/closed state

Use the open modifier to conditionally add styles when a <details> or <dialog> element is in an open state:

Try toggling the disclosure to see the styles change

Why do they call it Ovaltine?

The mug is round. The jar is round. They should call it Roundtine.

                
                  <div class="max-w-lg mx-auto p-8">
                    <details class="open:bg-white dark:open:bg-neutral-900 open:ring-1 open:ring-black/5 dark:open:ring-white/10 open:shadow-lg p-6 rounded-lg" open>
                      <summary class="text-sm leading-6 text-gray-900 dark:text-white font-semibold select-none">
                        Why do they call it Ovaltine?
                      </summary>
                      <div class="mt-3 text-sm leading-6 text-gray-600 dark:text-neutral-400">
                        <p>The mug is round. The jar is round. They should call it Roundtine.</p>
                      </div>
                    </details>
                  </div>