AI can generate CSS surprisingly fast.

Give it a screenshot, a short description, or a few design requirements, and it can produce a layout with gradients, animations, responsive breakpoints, and nicely styled components.

Sometimes the result is genuinely good.

But there's a problem I keep coming back to: writing CSS is not the same as understanding the design problem behind it.

Ask an AI tool to "make this page modern and responsive," and you'll probably get a reasonable starting point. But what does modern mean for this particular product? Which parts of the interface deserve attention? How should the layout behave when the content changes? What happens when a user increases their font size or enables reduced motion?

These questions aren't answered by generating more CSS.

A useful way to think about this comes from a simple idea: AI systems need to manage ambiguity, not just produce an answer. When the request lacks intent or context, a reliable system should identify what's missing, ask better questions, and be clear about its assumptions.

That principle applies to CSS more than we might think.

Here are ten things AI still cannot reliably handle on its own.

1. Understand What "Make It Look Better" Actually Means

This is probably the most common problem with AI-generated CSS.

A developer asks:

"Make this card look more modern."

The AI adds a gradient, increases the border radius, adds a shadow, and changes the spacing.

Technically, it has followed the request. But did it improve the design?

Maybe the original card was supposed to look minimal. Maybe the product uses sharp corners and restrained colors. Maybe the real problem was poor information hierarchy rather than appearance.

Words such as "modern," "clean," "premium," and "professional" are subjective. They don't describe exact CSS properties.

For one product, a clean design might mean generous whitespace and subtle borders. For another, it might mean dense information, strong contrast, and compact components.

Compare these two directions:

/* Minimal and restrained */ .card { background: #fff; border: 1px solid #e5e7eb; border-radius: 0.5rem; padding: 1.5rem; } /* More expressive */ .card { background: linear-gradient(135deg, #312e81, #7c3aed); border: 0; border-radius: 1.25rem; padding: 2rem; color: white; box-shadow: 0 16px 40px rgb(49 46 129 / 25%); } 

Neither is automatically better. The right choice depends on the product, its audience, and the visual language of the rest of the interface.

AI can generate both. Choosing the right direction requires understanding what the design is trying to communicate.

The point: A vague design request needs clarification, not another random collection of CSS properties.

2. Understand the Context Behind a Layout

CSS doesn't work in isolation.

A component lives inside a document, a page, a design system, and an application. Its behavior depends on the content around it and the constraints of the environment.

An AI-generated component might look perfect in a small example:

.profile-card { display: flex; align-items: center; gap: 1rem; padding: 1.5rem; } 

But what happens when:

  • The user's name is very long?
  • The profile image is missing?
  • The description contains several paragraphs?
  • The interface is translated?
  • The parent container becomes narrow?
  • The application uses a different design system?

The code itself doesn't tell us which of these situations matters.

This is the difference between generating a component and understanding its context.

A more flexible component might use:

.profile-card { display: flex; align-items: flex-start; gap: 1rem; min-width: 0; padding: clamp(1rem, 3vw, 1.5rem); } .profile-card__content { min-width: 0; overflow-wrap: anywhere; } 

The min-width: 0 declaration is particularly useful in flex and grid layouts where children might otherwise refuse to shrink below their min-content size.

It's a small detail, but it can prevent real layout problems.

The point: Good CSS depends on knowing where a component lives and what kind of content it must handle.

3. Decide Which Visual Details Actually Matter

Not every element should have the same visual importance.

A primary action should usually be easier to notice than a secondary link. A page heading should establish a clear hierarchy. Important information should not compete with decorative elements.

AI can generate a visually consistent interface, but visual consistency alone doesn't guarantee a useful hierarchy.

Consider a page with three actions:

.button-primary { background: #2563eb; color: white; font-weight: 700; } .button-secondary { background: #e5e7eb; color: #111827; } .button-tertiary { background: transparent; color: #475569; } 

The CSS creates three distinct visual treatments.

But which action should be primary? That decision cannot be made just by looking at the selectors.

A payment confirmation, a destructive delete action, and a simple "Learn more" link have different levels of importance and risk.

The hierarchy should reflect what users need to do, not simply what looks attractive.

This is also where design taste matters. Good design is often about knowing what to remove, not what else to add.

The point: AI can style elements consistently, but deciding what deserves attention requires an understanding of the user's goal.

4. Predict How a Layout Will Behave With Real Content

A layout can look perfect with placeholder text and fall apart as soon as real content arrives.

This is one of the reasons testing CSS with only a single screenshot is misleading.

Imagine a three-column product grid:

.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } 

It looks reasonable on a desktop.

But the implementation doesn't explain what should happen on smaller screens, when the product titles become longer, or when the available space changes.

A more flexible starting point is:

.product-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 1.5rem; } 

The browser can now fit as many columns as the available space allows, while preserving a minimum card width that can still shrink when necessary.

You can also use container queries when a component should respond to its own available space rather than the viewport:

.product-list { container-type: inline-size; container-name: products; } @container products (min-width: 42rem) { .product-card { display: grid; grid-template-columns: 10rem 1fr; align-items: center; } } 

This makes the card layout dependent on its container.

But even flexible CSS cannot tell you what the correct experience should be for every content variation. Long translations, unusually large text, empty states, and real user-generated content still need testing.

The point: A responsive layout is not proven by one screenshot. It needs to survive realistic content and changing constraints.

Reference: MDN — Responsive Web Design · MDN — Container Queries

5. Make Animations Feel Natural and Respect User Preferences

Animations are easy to generate. Good motion design is harder.

AI can produce a button hover effect, an animated card, or a page transition with very little effort.

But should everything move?

A subtle transition can help users understand a change. Too much movement can distract them, make the interface feel slower, or cause discomfort.

Consider this simple interaction:

.action-button { transition: background-color 180ms ease, transform 180ms ease; } .action-button:hover { transform: translateY(-2px); } 

It is a reasonable effect for a desktop interface.

However, the same movement should not automatically be applied to every element in every context.

A more considerate implementation includes a reduced-motion alternative:

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } } 

This is a broad example. In a production design system, it is often better to define reduced-motion behavior deliberately for individual animation patterns rather than blindly overriding every element.

The important part is that CSS provides a way to respect the user's operating-system preference.

The developer still needs to decide which animations are essential, which can be removed, and which should be replaced with less intense feedback.

The point: Animation is not decoration. It is part of how people interact with an interface.

References: MDN — prefers-reduced-motion · MDN — CSS Performance

6. Understand Accessibility Beyond a Few CSS Rules

Accessibility is often treated as a checklist.

Increase the font size. Add contrast. Make the focus outline visible. Done.

Unfortunately, real accessibility is not that simple.

For example, consider this rule:

button { outline: none; } 

It might make the interface look cleaner when clicking with a mouse, but it also removes the default focus indicator unless another focus style is provided.

A better approach is to style keyboard focus intentionally:

button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; } 

Contrast is another important consideration.

For normal text, WCAG 2.2 Level AA generally requires a contrast ratio of at least 4.5:1. Large text has a lower minimum of 3:1.

But accessibility goes beyond color.

It also involves:

  • Readable layouts when text is enlarged.
  • Visible keyboard focus.
  • Clear hover, focus, and active states.
  • Reduced-motion support.
  • Avoiding information communicated through color alone.
  • Maintaining usable layouts at different zoom levels.

CSS can support many of these requirements, but it cannot independently determine whether the entire application is accessible.

For example, CSS cannot fix a missing accessible name on an HTML button. That requires correct HTML semantics as well.

Automated checks can help identify problems, but manual testing is still necessary.

The point: An accessible stylesheet is part of an accessible interface, not a substitute for one.

References: W3C — WCAG 2.2 · W3C — Focus Appearance

7. Debug the CSS Cascade in the Context of a Real Project

One of the most frustrating CSS problems is when a declaration looks correct but does not produce the expected result.

You write:

.card-title { color: red; } 

Nothing changes.

Maybe another selector has higher specificity. Maybe a cascade layer takes precedence. Maybe the declaration is overridden by an inline style or an inherited value.

Understanding the issue requires more than reading the selector.

CSS uses a defined cascade algorithm involving origin, importance, cascade layers, specificity, scoping proximity, and source order.

For example:

@layer base, components, utilities; @layer components { .card-title { color: red; } } @layer utilities { .card-title { color: blue; } } 

For normal declarations in these named layers, the later utilities layer wins.

But there is an important detail: normal unlayered author styles take precedence over normal declarations inside named author layers.

That's why understanding the complete stylesheet matters.

In a real project, you might also be dealing with third-party frameworks, CSS Modules, component libraries, global styles, and dynamically injected styles.

AI can explain specificity and suggest possible fixes. Without inspecting the actual rendered element and its matched declarations, it cannot reliably identify every cause.

The browser's DevTools are still essential.

The point: CSS debugging is not guessing which selector needs another !important. It is understanding how the browser resolves competing declarations.

Reference: MDN — Introduction to the CSS Cascade

8. Choose the Right Balance Between Performance and Visual Quality

A common misconception is that shorter CSS always means faster rendering.

It doesn't.

A stylesheet with fewer lines can still cause expensive rendering work. A visually impressive animation can affect frame rates. Excessive filters, shadows, large images, and unnecessary effects can all contribute to a poor experience.

Consider an animated panel:

.panel { transition: transform 250ms ease, opacity 250ms ease; } .panel.is-hidden { transform: translateY(1rem); opacity: 0; } 

This is often a good starting point because animating transform and opacity can avoid layout recalculations.

Compare that with repeatedly animating layout properties such as width, height, or margin. Those changes can trigger additional layout and rendering work.

However, don't turn this into another universal rule. Browser rendering is complex, and the best choice depends on the page, the elements involved, and the device.

Even will-change should not be added everywhere. It is a hint for specific performance situations, not a general-purpose optimization switch.

The right process is:

  1. Identify the actual performance problem.
  2. Measure it in browser developer tools.
  3. Find the CSS or rendering work responsible.
  4. Make a targeted change.
  5. Measure again.

The point: AI can suggest optimizations, but real performance decisions should be based on evidence rather than assumptions.

References: MDN — CSS Performance Optimization · MDN — Animation Performance

9. Know When a CSS Feature Needs a Fallback

Modern CSS gives developers powerful features.

Container queries, cascade layers, nesting, advanced color functions, and many other capabilities make stylesheets more expressive.

But production code has to consider the browsers and environments used by the audience.

A feature that works in your development browser might not work in an older embedded browser or a specific environment your product still supports.

This is where progressive enhancement becomes useful.

For example:

.card { display: block; padding: 1rem; } @supports (display: grid) { .card-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; } } 

The base layout remains usable, while browsers supporting the feature receive the enhanced grid layout.

This example uses a widely supported feature, but the pattern is useful for newer CSS capabilities too.

You can check browser support using compatibility documentation and feature detection rather than assuming that every user has the same environment.

The decision also depends on the importance of the feature.

A missing decorative effect is usually not a problem. A missing layout rule that makes the entire page unusable is a much bigger issue.

The point: Knowing CSS syntax is one thing. Knowing whether a feature is safe to depend on is another.

Reference: MDN — @supports

10. Admit When the Requirements Are Unclear and Ask the Right Questions

This connects to the most important idea in the PDF.

A system should not treat every unclear request as if it contains enough information to produce a reliable answer.

The PDF discusses two related problems: linguistic ambiguity and missing context. It also describes a better approach: validate the input, identify missing requirements, ask focused questions, offer examples, and explain limitations.

The same approach can improve AI-assisted CSS development.

Imagine this request:

"Create a responsive pricing section with a modern design."

Several important questions are still unanswered:

  • How many pricing plans are there?
  • Which plan should receive visual emphasis?
  • Is the layout intended for desktop, mobile, or both?
  • Does the project already have design tokens?
  • Which browsers need to be supported?
  • Are there existing components that should be reused?

An AI tool could make assumptions and generate a result immediately.

A better workflow is to clarify the most important missing information first.

For example:

AI: Should the pricing cards have equal visual importance, or should one plan be highlighted as the recommended option?

Developer: Highlight the middle plan, but keep the other plans equally readable.

That single clarification changes the design direction.

Another useful approach is to request alternatives:

Create three CSS design directions for this pricing section: 1. Minimal and clean 2. Bold and conversion-focused 3. Editorial and premium Keep the same content and functionality. Explain the trade-offs of each option. 

The goal is not to ask questions forever. It is to avoid making important decisions based on guesses.

And when the available information is still insufficient, the system should say so instead of pretending the result is definitive.

That's not a weakness. It's a better way to work.

The point: A good CSS workflow includes clarification, assumptions, alternatives, feedback, and testing—not just code generation.

A Better Way to Use AI for CSS

None of this means AI is bad at CSS.

It can save a lot of time with repetitive styles, responsive layout experiments, selector explanations, animation prototypes, refactoring, and debugging suggestions.

The important thing is to treat its output as a proposal rather than a finished design decision.

A workflow I would recommend looks like this:

  1. Describe the actual problem, not just the desired appearance.
  2. Provide the content, layout constraints, and browser requirements.
  3. Ask for alternatives when the visual direction is uncertain.
  4. Generate a first implementation.
  5. Test it with realistic content and different viewport sizes.
  6. Check accessibility and motion preferences.
  7. Inspect the cascade and profile performance.
  8. Refine the result based on what actually happens in the browser.

This also creates a useful feedback loop. Every issue you find tells you something about the original requirements, the implementation, or the assumptions behind it.