Open In App

Tailwind CSS Placeholder Opacity

Last Updated : 18 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

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>
<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="[email protected]">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-75 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-50 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-green-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-25 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-100 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-75 border-2
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-50 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-yellow-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-25 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-100 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-75 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-50 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
        <input class="placeholder-indigo-800 p-3 m-2 rounded-lg 
                      placeholder-opacity-25 border-2 
                      border-green-400 bg-green-100" placeholder="[email protected]">
    </div>
</body>

</html>

Output:

placeholder opacity


Next Article

Similar Reads