A TailwindCSS plugin that adds centering utilities.
npm install --save-dev tailwindcss-centerOther Package Managers
yarn add --dev tailwindcss-centerAdd 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"),
],
};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>center-flexcenter-flex-xcenter-flex-y
center-gridcenter-grid-xcenter-grid-y
center-absolutecenter-absolute-xcenter-absolute-y
center-margincenter-margin-xcenter-margin-y
- @marcoguidara/tailwind-quick-center - A plugin that provides utilities for centering an element on x/y axis.