Fluid Container Plugin for Tailwind CSS
Requirements
This plugin requires Tailwind CSS 1.2 or later. If your project uses an older version of Tailwind, you should install the latest 2.x version of this plugin (npm install tailwindcss-fluid-container@2.x
).
Installation
npm install tailwindcss-fluid-container
Usage
Simple
// tailwind.config.jsmoduleexports = theme: fluidContainer: 'default': maxWidth: '800px' // defaults to null (no max width) padding: '15px' // defaults to '15px' variants: // for the utilities fluidContainer: 'responsive' // defaults to ['responsive'] plugins: ;
The above configuration would generate the following CSS:
/* the container component itself */ /* a bunch of utilities to help you align things with the container */
Advanced
// tailwind.config.jsmoduleexports = theme: fluidContainer: 'small': maxWidth: // defaults to null (no max width) default: '800px' lg: '1000px' padding: // defaults to '15px' default: '15px' sm: '30px' 'large': maxWidth: '1200px' // defaults to null (no max width) padding: // defaults to '15px' default: '15px' sm: '30px' variants: // for the utilities fluidContainer: 'responsive' // defaults to ['responsive'] plugins: componentPrefix: 'c-' // defaults to 'c-' widthUtilities: true // defaults to true paddingUtilities: true // defaults to true marginUtilities: true // defaults to true negativeMarginUtilities: true // defaults to true ;
The above configuration would generate the following CSS:
/* custom property definitions */{}{} /* the container components */ /* a bunch of utilities to help you align things with the containers *//* etc. (see the simple example above for the whole list) */