Open In App
Related Articles

Tailwind CSS Ring Opacity

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. By using this class we can set the opacity of any ring. In CSS, we do that by using the CSS Opacity property.

Ring Opacity class:

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

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

Syntax:

<button class="ring-{opacity}">...</button>

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"
    <h1 class="text-green-600 text-5xl font-bold"
    GeeksforGeeks 
    </h1
    <b>Tailwind CSS Ring Opacity Class</b
    <div class="mx-16 grid grid-cols-5 gap-2  p-2">
        <button class="ring-0 ring-green-600 bg-green-400 
                       ring-opacity-25 w-full h-12 rounded-lg">
            Ring-0
        </button>
        <button class="ring-1 ring-green-600 bg-green-400 
                       ring-opacity-25 w-full h-12 rounded-lg">
            Ring-1
        </button>
        <button class="ring-2 ring-green-600 bg-green-400 
                       ring-opacity-25 w-full h-12 rounded-lg">
            Ring-2
        </button>
        <button class="ring-4 ring-green-600 bg-green-400 
                       ring-opacity-25 w-full h-12 rounded-lg">
            Ring-4
        </button>
        <button class="ring-8 ring-green-600 bg-green-400 
                       ring-opacity-25 w-full h-12 rounded-lg">
            Ring-8
        </button>
  
    </div>
</body
</html>

                    

Note: Currently the browsers are not supported by Tailwind CSS Ring Width, so for the output, refer to the link of the output.(Tailwind CSS Playground)

Output: 

ring opacity

Refer: https://play.tailwindcss.com/oyrZcKTljL



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