Tailwindcss: wrong class name for margins while using prefix

Created on 27 Jun 2019  路  4Comments  路  Source: tailwindlabs/tailwindcss

When using a prefix 'tw-' class names for margins has double hyphen in name

  .sm\:tw--my-1 {
    margin-top: -0.25rem;
    margin-bottom: -0.25rem
  }

  .sm\:tw--mx-1 {
    margin-left: -0.25rem;
    margin-right: -0.25rem
  }

All 4 comments

@snimavat not sure the class name can be considered "wrong", it's just following the tailwind convention of starting the class name with a dash for negative margins. The normal un-prefixed names of those classes are -mx-1 and -mx-2.

I agree that it looks weird when the prefix also ends with a dash, but remember that the prefix can be changed to anything you want. Maybe if you prefix with tw_ or tw> it will look more normal.

tw>-mx-1
tw_-mx-1

Not sure if wrong, it makes sense and works according to the docs too, the "prefix is added to the beginning of each utility name".
Your prefix could also be tw_ which would result in .sm\:tw_-my-1.

Changing the behavior at this point would also be a breaking change.

@tlgreg great minds think alike 馃く

Oh i see... nevermind.. closing the issue.
New here... did not notice tht it was just for negative margins..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

manniL picture manniL  路  3Comments

lamberttraccard picture lamberttraccard  路  3Comments

divdax picture divdax  路  3Comments

spyric picture spyric  路  3Comments

dbpolito picture dbpolito  路  3Comments