Home >Web Front-end >JS Tutorial >Set Up Tailwind CSS in a React JS Project
If you don’t have a React app already, create one:
npx create-react-app my-app cd my-app
npm install -D tailwindcss postcss autoprefixer
Then initialize Tailwind CSS:
npx tailwindcss init
This will create a tailwind.config.js file in your project.
/** @type {import('tailwindcss').Config} */ module.exports = { content: [ "./src/**/*.{js,jsx,ts,tsx}", // Scan these files for Tailwind classes ], theme: { extend: {}, }, plugins: [], };
@tailwind base; @tailwind components; @tailwind utilities;
import './index.css';
npm start
The above is the detailed content of Set Up Tailwind CSS in a React JS Project. For more information, please follow other related articles on the PHP Chinese website!