Tailwindcss: Unexpected padding specificity due to rule definition order

Created on 16 Nov 2017  路  4Comments  路  Source: tailwindlabs/tailwindcss

I noticed that .pl-0 is defined _before_ .p-4, and thus they cannot be used together in order to set general-then-more-specific styles, e.g.

<div id="foo" class="p-4 pl-0">foo</div>

Expected: #foo { left-padding: 0; }
Actual: #foo { left-padding: 4; }

It seems all .p-n classes are defined after their related .px-n counterparts.

minimal test case

Most helpful comment

Merged this in, going to tag new release today 馃憤

All 4 comments

We can definitely look into tweaking the order these are defined to make that possible. It's hard to make this always work for everyone exactly as expected though, so generally we recommend avoiding using colliding styles, instead setting them separately:

<div class="py-4 pr-4"></div>

I think we can fix this case to be more intuitive though 馃憤

We're gonna fix this for 0.2 馃檶馃徎

Thanks for the PR, it really does seem more intuitive. 馃憦

Merged this in, going to tag new release today 馃憤

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rgaufman picture rgaufman  路  3Comments

jbardnz picture jbardnz  路  3Comments

divdax picture divdax  路  3Comments

spyric picture spyric  路  3Comments

Tjoosten picture Tjoosten  路  3Comments