Gradient stop opacity
Utilities for controlling the opacity of color stops in background gradients
Class reference
Starting opacity
Set the starting opacity of a gradient using the from-opacity-{amount}
utilities.
By default all gradients do not fade to transparent.
Ending opacity
Set the ending opacity of a gradient using the to-opacity-{amount}
utilities.
Middle opacity
Add a middle opacity to a gradient using the via-opacity-{amount}
utilities.
Responsive
To control the opacity of a gradient color stop at a specific breakpoint, add a {screen}:
prefix to any existing gradient stop opacity utility. For example, use md:from-opacity-30
to apply the from-opacity-30
utility at only medium screen sizes and above.
<div class="bg-gradient-to-r from-violet-400 md:from-opacity-30"></div>
For more information about Elements’ responsive design features, check out the Responsive Design documentation.
Hover
To control the gradient stop opacity of an element on hover, add the hover:
prefix to any existing gradient stop opacity utility. For example, use hover:from-opacity-30
to apply the from-opacity-30
utility on hover.
Hover utilities can also be combined with responsive utilities by adding the responsive {screen}:
prefix before the focus:
prefix.
<button class="... md:from-opacity-30 md:hover:from-opacity-50 ...">Button</button>
Focus
To control the gradient stop opacity of an element on focus, add the focus:
prefix to any existing gradient stop opacity utility. For example, use focus:from-opacity-30
to apply the from-opacity-30
utility on focus.
Focus utilities can also be combined with responsive utilities by adding the responsive {screen}:
prefix before the focus:
prefix.
<button class="... md:from-opacity-30 md:focus:from-opacity-50 ...">Button</button>
On this Page
v1.13.5