Gotcha: Text Alignment vs. Block Centering

The text-center utility aligns text *within* its block-level container. It does not center the container itself on the page.

Incorrect Attempt to Center a Block:

This div has a width ( w-1/2 ) and text-center . The text inside is centered, but the div itself is not centered on the page.

Div with text-center

My text is centered, but I (the red box) am not!

Notice the red box is left-aligned within this section.

Correct Way to Center a Block:

This div uses mx-auto to center the block itself, and text-center to center its internal text content.

Div with text-center and mx-auto

My text is centered, AND I (the green box) am centered!

Notice the green box is now centered on the page.

Key Takeaway (Gotcha Explained):