Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tommy-mitchell/tailwindcss-center

A TailwindCSS plugin that adds centering utilities.
https://github.com/tommy-mitchell/tailwindcss-center

centering flexbox grid tailwindcss tailwindcss-plugin

Last synced: about 1 month ago
JSON representation

A TailwindCSS plugin that adds centering utilities.

Awesome Lists containing this project

README

        

# tailwindcss-center

A TailwindCSS plugin that adds centering utilities.

## Install

```sh
npm install --save-dev tailwindcss-center
```

Other Package Managers

```sh
yarn add --dev tailwindcss-center
```

Add the plugin to your Tailwind config:

```ts
import tailwindPluginCenter from "tailwindcss-center";

export default {
theme: {
// ...
},
plugins: [
tailwindPluginCenter,
],
};
```

CommonJS Configs

```ts
module.exports = {
theme: {
// ...
},
plugins: [
require("tailwindcss-center"),
],
};
```

## Usage

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

```html




```

Centering can also be applied individually to a specific axis:

```html






```

### 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`

## Related

- [@marcoguidara/tailwind-quick-center](https://github.com/marcoguidara/tailwindcss-quick-center) - A plugin that provides utilities for centering an element on x/y axis.