Skip to content

Cannot override tailwind utilities. #16856

@acalvino4

Description

@acalvino4

What version of Tailwind CSS are you using?

v4.0.9

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

N/A - tw play

What version of Node.js are you using?

N/A - tw play

What browser are you using?

Brave

What operating system are you using?

MacOS

Reproduction URL

https://play.tailwindcss.com/4Nn2WwpPU3?file=css

Describe your issue

When I try to override a base tailwind class...

@import "tailwindcss";

@utility w-10 {
  width: 100px;
}

...it does not have any effect because in the output css, tailwind's generated utility comes later:

.w-10 {
  width: 100px;
}
.w-10 {
  width: calc(var(--spacing) * 10);
}

I would expect that any utility declarations I put after @import tailwindcss would override it.

Additionally, though it probably makes sense to list both of these in the output css file in dev, the production build should have this reduced to a single width declaration: .w-10{width:100px} (this works on the lightning css playground, hence my assumption). Instead I'm getting .w-10{width:100px;width:calc(var(--spacing)*10)}.

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