Skip to content
Related Articles
Get the best out of our app
GFG App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Tailwind CSS Text Opacity

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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

Text Opacity:

  • text-opacity-0: Control the opacity of an element’s placeholder color using the text-opacity-{amount} utilities.

Note: The number of the opacity can be changeable from 0 to 100 with the span of 5.

Syntax:

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

Example:

HTML




<!DOCTYPE html>
<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 Text Opacity Class</b>
    <div class="mx-14 bg-green-200 grid grid-rows-4
                grid-flow-col text-justify p-4">
      <p class="text-green-800 text-opacity-100 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-green-800 text-opacity-75 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-green-800 text-opacity-50 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-green-800 text-opacity-25 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-yellow-800 text-opacity-100 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-yellow-800 text-opacity-75 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-yellow-800 text-opacity-50 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-yellow-800 text-opacity-25 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-pink-800 text-opacity-100 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-pink-800 text-opacity-75 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-pink-800 text-opacity-50 p-2">
        A Computer Science Portal for Geeks
      </p>
  
      <p class="text-pink-800 text-opacity-25 p-2">
        A Computer Science Portal for Geeks
      </p>
    </div>
  </body>
</html>


Output:

Opacity


My Personal Notes arrow_drop_up
Last Updated : 23 Mar, 2022
Like Article
Save Article
Similar Reads
Related Tutorials