Open In App

Tailwind CSS Text Color

This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. By using this class we can color any text. In CSS, we do that by using the CSS Color property.

Text Color classes:



Note: The color’s values can be changeable according to your need from 50-900, the span should be 100, after the 100.

Syntax:



<element class="text-{color}">...</element>

Example: All the possible classes are covered in this example, you can change the color value to make it more contrast, full, or make it more faded.




<!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"
    <h2 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h2
    <b>Tailwind CSS Text Color Class</b
    <div class="mx-14 bg-green-200 grid grid-rows-4
                grid-flow-col text-justify p-4">
          
       <p class="text-transparent p-2">
         A Computer Science Portal for Geeks
       </p>
  
       <p class="text-current p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-black p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-white p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-gray-700 p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-red-700 p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-indigo-700 p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-blue-700 p-2">
           A Computer Science Portal for Geeks
       </p>
  
       <p class="text-green-700 p-2">
          A Computer Science Portal for Geeks
       </p>
  
       <p class="text-yellow-700 p-2">
          A Computer Science Portal for Geeks
       </p>
  
       <p class="text-pink-700 p-2">
          A Computer Science Portal for Geeks
       </p>
  
       <p class="text-purple-700 p-2">
          A Computer Science Portal for Geeks
       </p>
  
  
    </div>
</body
  
</html

Output:

CSS text color


Article Tags :