Skip to content

Using custom variants in utilities with important feature #8305

@jarosan

Description

@jarosan

What version of Tailwind CSS are you using?

3.0.24

What build tool (or framework if it abstracts the build tool) are you using?

postcss-cli 9.1.0

What version of Node.js are you using?

16

Reproduction URL

https://play.tailwindcss.com/WxwCNZmQFX

Describe your issue

I want to setup custom variant for the webpage if it is loaded inside the iframe.

When using this custom variant together with important: '#csc-app' feature it produces different selectors if the classes are defined in the html or in the utilities.

If the variant is used in the html then .usage-variant_iframe selector comes after the important selector:

#csc-app .usage-variant_iframe .iframe\:text-sm

If the variant is used in the utility then .usage-variant_iframe selector comes before the important selector:

.usage-variant_iframe #csc-app .custom-utility

As a work around i'm adding the .usage-variant_iframe twice right now. Once before the #csc-app div and second time after, but it would be great if this can be consistent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions