A custom Tailwind width or height class has no effect
w-[350px] has no effect in the browserShort answer
Tailwind only creates CSS for class names it finds as complete strings in files it scans. A custom size fails when the syntax is wrong, when the class is built from parts at runtime, or when the file sits outside the scanned paths. Use w-[350px], write full names, and register extra paths.
Fix it fast
1Find out which cause you have
Search the generated stylesheet for the class. If it is missing from the CSS, Tailwind never saw it. If it is there, another rule is overriding it.
grep -rl "350px" dist build .next 2>/dev/null2Match what you see, then jump to its fix
- 1
The class looks like w-350px or w-350, and nothing is generated.The class name is wrong for a custom valueFix - 2
The class is written like `w-[${size}px]` or `w-${n}` in code.The class name is built from parts at runtimeFix - 3
Classes work in some files and not in a shared library or a folder listed in .gitignore.The file with the class is outside what Tailwind scansFix
- 1
What does the error look like?
w-[350px] has no effect in the browserThe same width written in plain CSS works
Cause 1 of 3
The class name is wrong for a custom value
1Check
The w-<number> form multiplies the spacing scale, so w-350 does not mean 350px. A fixed custom size needs square brackets.
grep -rn "w-350" src/2Fix
Use the arbitrary value form. For a CSS variable use the parentheses form in Tailwind 4.
<div className="w-[350px] h-[200px]" />
<div className="w-(--my-width)" />3Verify
Reload and inspect the element: width should be 350px.
npm run devConfirmed by tailwindcss.com
Cause 2 of 3
The class name is built from parts at runtime
1Check
Tailwind reads source files as plain text and cannot see a name assembled from variables.
grep -rn "w-\${" src/2Fix
Write complete class names and choose between them, or map a prop to full names.
const widths = {
small: "w-[200px]",
large: "w-[400px]",
};
return <div className={widths[size]} />;3Verify
Render each variant and check that the width changes.
npm run devConfirmed by tailwindcss.com
Cause 3 of 3
The file with the class is outside what Tailwind scans
1Check
Tailwind 4 scans the project but skips files in .gitignore, node_modules and binary files.
cat .gitignore2Fix
Register the extra path in your CSS with @source.
@import "tailwindcss";
@source "../node_modules/@acmecorp/ui-lib";3Verify
Restart the dev server and check that the class now has an effect.
npm run devConfirmed by tailwindcss.com
How do I stop it coming back?
- Keep full class names in the source, even when you choose between them with a condition.
- Use w-[value] for one-off sizes, and add a theme variable when a size repeats.
- Register library paths with @source when you share components between packages.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- WorkforceA field app, an admin console and a self-hosted Node.js server for push and reconciliation.
Related fixes
Web apps
shadcn/ui setup fails in a Vite React project using Tailwind v4
Imports from @/components/ui do not resolve in the editor or the build
shadcn init needs three things in a Vite project: Tailwind v4 installed with the @tailwindcss/vite plugin and a single @import "tailwindcss" line in your CSS, the @/* path alias in both tsconfig.json and tsconfig.app.json, and the same alias in vite.config.ts, with @types/node installed so path resolves.
4 causes, each with a fixWeb apps
React shows Attempted import error when importing a component or function
Attempted import error:
The build found the file but not the name you asked for.
2 causes, each with a fixWeb apps
AxiosError Network Error with code ERR_NETWORK in a React app
Network Error
ERR_NETWORK means the request produced no readable response.
4 causes, each with a fixWeb apps
Axios get works with a URL string but ignores the object passed as the second argument
The server log shows a GET with no query string
axios.get takes a URL and an optional config object.
3 causes, each with a fixWeb apps
Can't resolve '../axios' in a React project
Module not found: Error: Can't resolve '../axios'
A path that starts with ./ or ../ is a file path, not the axios package.
3 causes, each with a fixWeb apps
Axios returns 401 from a React app but the login works elsewhere
Error: Request failed with status code 401
A 401 means the server received the request without valid credentials.
3 causes, each with a fix