Opacity

    Control the opacity of an element using the utilities.

    To control the opacity of an element at a specific breakpoint, add a {screen}: prefix to any existing opacity utility. For example, use md:opacity-50 to apply the utility at only medium screen sizes and above.

    For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

    Opacity - 图2

    all

    sm

    md

    Opacity - 图5

    lg

    By default Tailwind provides five opacity utilities based on a simple numeric scale. You change, add, or remove these by editing the theme.opacity section of your Tailwind config.

    By default, only responsive, hover and focus variants are generated for opacity utilities.

    You can control which variants are generated for the opacity utilities by modifying the opacity property in the section of your tailwind.config.js file.

    For example, this config will also generate active and group-hover variants:

    If you don’t plan to use the opacity utilities in your project, you can disable them entirely by setting the opacity property to in the corePlugins section of your config file:


      Transition Property →