tailwindlabs / discuss

A place to ask questions, get help, or share what you've built with Tailwind CSS.
MIT License
171 stars 9 forks source link

Reduce or increase rem sizes on global scale in the config #448

Closed bzrncev closed 4 years ago

bzrncev commented 4 years ago

For my last project, the default spacing and font sizes were too big for me. This is how I solve it in my config:

const reduceCSSCalc = require("reduce-css-calc");
const percentage = 0.9;

module.exports = {
    theme: {
        spacing: {
            ...
        "1": reduceCSSCalc(`calc(0.25rem * ${percentage})`),
        "2": reduceCSSCalc(`calc(0.5rem * ${percentage})`),
         ...
    },
    fontSize: {
            xs: reduceCSSCalc(`calc(0.75rem * ${percentage})`),
            sm: reduceCSSCalc(`calc(0.875rem * ${percentage})`),
            ...
         }
    }
}

It will be better if there is a way to specify a scaling percentage in the config and all spacing, font sizes, etc. to respect it because now my config file is a mess.

adamwathan commented 4 years ago

Easiest way to accomplish the exact same thing:

html {
  font-size: 14.4px
}
bzrncev commented 4 years ago

Wow, didn't know that. Thanks for the tip! 👍