I am working on a project using HTML, CSS, vanilla JS, and Tailwind version 4. The installation of Tailwind is successful, but while customizing Tailwind, it fails to update. It would be a great help if anyone could help to sort this issue. I also tried to manually create tailwind.config.js and added it in input.css still not working. The project I used is like assets-> styles.cs,ssrc->input.css,index.html,tailwind.config.js
//package.json
{
"dependencies": {
"@tailwindcss/cli": "^4.1.11",
"tailwindcss": "^4.1.11"
},
"scripts": {
"dev": "npx @tailwindcss/cli -i ./src/input.css -o ./assets/styles.css --watch"
}
}
@import url("https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");
@import "tailwindcss";
@theme {
--font-display: "Poppins", "sans-serif";
--color-gray: #f5f5f5;
}
/*
need to update to version 4
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js}"],
theme: {
extend: {
fontFamily: {
custom: ["Poppins", "sans-serif"],
customSecFont: ["Inter", "sans-serif"],
},
colors: {
colorBlk: "rgba(49, 49, 49, 1)",
colorGr: "rgba(6, 166, 79, 1)",
colorBlue:"rgba(144, 189, 248, 1)"
},
container: {
center: true,
padding: "2rem",
screens:{
"3xl": "1440px",
}
},
screens: {
sm: "575px",
md: "768px",
lg: "992px",
xl: "1200px",
"2xl": "1400px",
"3xl": "1900px",
"max-xs": { max: "575px" },
"max-sm": { max: "767px" },
"max-md": { max: "991px" },
"max-lg": { max: "1199px" },
"max-xl": { max: "1399px" },
"max-xxl": { max: "1899px" },
},
},
},
plugins: [],
};
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="assets/styles.css" rel="stylesheet" />
</head>
<body>
<h1 class="font-display text-color-gray p-5 text-3xl font-medium underline text-center text-color-gray bg-red-700">Hello world!</h1><!-- text-color-gray not working -->
</body>
</html>
tailwind.config.jsfor you to the new v4 configuration? I don't exactly understand where you got stuck if you found the@themeand used it as well.