Open In App
Related Articles

Tailwind CSS Font Size

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

This class accepts lots of value in tailwind CSS in which all the properties are covered as in class form.  It is the alternative to the CSS font-size property. This class is used to set the font size of the text in an HTML document.

Font size classes:

  • text-xs: This class defines the text size as extra small.
  • text-sm: This class defines the text size as small.
  • text-base: This class defines the text size as base size.
  • text-lg: This class defines the text size as large.
  • text-xl: This class defines the text size as extra-large.
  • text-2xl: This class defines the text size as 2 times extra-large.
  • text-3xl: This class defines the text size as 3 times extra-large.
  • text-4xl: This class defines the text size as 4 times extra-large.
  • text-5xl: This class defines the text size as 5 times extra-large.
  • text-6xl: This class defines the text size as 6 times extra-large.
  • text-7xl: This class defines the text size as 7 times extra-large.
  • text-8xl: This class defines the text size as 8 times extra-large.
  • text-9xl: This class defines the text size as 9 times extra-large.

Note: Change the size in the component with the required size mentioned above.

Syntax:

<element class="text-size">...</element>

Example:

HTML

<!DOCTYPE html> 
<head
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
          rel="stylesheet"
</head
  
<body class="text-center mx-4 space-y-2"
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1
    <b>Tailwind CSS Font Size Class</b
    <div class="mx-24 bg-green-200">
        <p class="text-xs">
            Geeksforgeeks: A Computer Science portal for Geeks
        </p>
  
        <p class="text-sm">
            Geeksforgeeks: A Computer Science portal for Geeks
        </p>
  
        <p class="text-base">
            Geeksforgeeks: A Computer Science portal for Geeks
        </p>
  
        <p class="text-lg">
            Geeksforgeeks: A Computer Science portal for Geeks
        </p>
  
        <p class="text-xl">
            Geeksforgeeks: A Computer Science portal for Geeks
        </p>
  
    </div>
</body
  
</html

                    

Output:



Last Updated : 23 Mar, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads