JSPM

tailwindcss-center

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q13167F
  • License MIT

A TailwindCSS plugin that adds centering utilities.

Package Exports

  • tailwindcss-center
  • tailwindcss-center/package.json

Readme

tailwindcss-center

A TailwindCSS plugin that adds centering utilities.

Install

npm install --save-dev tailwindcss-center
Other Package Managers
yarn add --dev tailwindcss-center

Add the plugin to your Tailwind config:

import tailwindPluginCenter from "tailwindcss-center";

export default {
    theme: {
        // ...
    },
    plugins: [
        tailwindPluginCenter,
    ],
};
CommonJS Configs
module.exports = {
    theme: {
        // ...
    },
    plugins: [
        require("tailwindcss-center"),
    ],
};

Usage

Utilities are provided for centering with Flexbox, CSS Grid, absolute positioning, and auto margins:

<div class="center-flex">
    <!-- ... -->
</div>

Centering can also be applied individually to a specific axis:

<div class="center-flex-x">
    <!-- ... -->
</div>

<div class="center-flex-y">
    <!-- ... -->
</div>

Provided Utilities

Flex

  • center-flex
  • center-flex-x
  • center-flex-y

Grid

  • center-grid
  • center-grid-x
  • center-grid-y

Absolute

  • center-absolute
  • center-absolute-x
  • center-absolute-y

Margin

  • center-margin
  • center-margin-x
  • center-margin-y