React Only Generates the HTML — CSS Does the Styling

Ask “How do I center a <div> in React?” and you're likely asking the wrong question entirely. As Dave Ceddia explains, React itself has zero involvement in how elements look or where they sit on the page.

React cares exactly zero about styling. Think of it as generating the barebones HTML. React will put elements on the page, but everything after that is the job of CSS: how they appear, what they look like, how they’re positioned, and how centered or uncentered they are.

Centering elements is a CSS problem, not a framework problem. Ceddia’s advice: drop “react” from your search query, solve the styling issue with CSS, then use React purely to apply the correct class name to your components.

The same confusion extends to other platforms. Asking how to center a <div> in WordPress or Vue is similarly broken — those technologies don’t manage visual layout. However, higher-level frameworks sometimes complicate matters: a WordPress site built with Gutenberg may have its own centering mechanisms you should use for consistency, and a styling library can force you to write CSS in a specific way rather than plain stylesheets. It’s all part of the inherent complexity of building for the web.