Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Tailwind CSS Placeholder Opacity

  • Last Updated : 17 Feb, 2021

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 placeholder text. In CSS, we do that by using the CSS Opacity property. 

Placeholder Opacity class:

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

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

Syntax:

<element class="placeholder-{opacity}">...</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 Placeholder Opacity Class</b
    <div class="mx-14 bg-green-200 grid grid-rows-4
                grid-flow-col text-justify p-4">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-100 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-75 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-50 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-25 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-100 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-75 border-2
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-50 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-25 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-100 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-75 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-50 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-25 border-2 
                      border-green-400 bg-green-100" 
               placeholder="Geeksforgeeks@gfg.org">
   
    </div>
</body
  
</html

Output:

placeholder opacity




My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!