I shipped a Surging Sparks chase guide, and its headings were quietly broken on the live site. In my local review surface the same article had looked right.
The guide is a blog article for BinderDex, my Pokémon card collection and price app. Surging Sparks is a Pokémon card set, and a chase guide covers the cards in it that collectors most want to find.
The difference was one layer of markup. The public route wraps article content in an analytics wrapper, and my heading styles hung off my article container component through a descendant selector. With the wrapper in between, that selector never matched. H2s lost their spacing, H3s lost their scale, and the auto-generated heading anchors picked up ordinary underlined link styling.
Styles that travel with the heading
A selector that depends on a parent breaks whenever the tree around it changes. So I stopped styling headings from the outside and mapped the h2 and h3 headings in my MDX articles (Markdown that can embed components) to dedicated components that carry their own classes:
const BlogH2 = ({ className, ...props }) => (
<h2
{...props}
className={cn(className, "mt-16 scroll-mt-28 text-balance text-2xl font-semibold leading-tight sm:mt-20 sm:text-3xl")}
/>
);
The hash-link anchors inside headings got their own class branch too. A section link now inherits the heading's text color and drops the underline, so it reads as part of the heading. Desktop and the 390px mobile view both show a clean hierarchy.
The guide that exposed it
The chase guide is the first article on BinderDex to use the new components in production. It targets a search query about the set's chase cards that I validated earlier in the week and links the first mention of each featured card to its card page. It also carries BreadcrumbList structured data, so posts can show breadcrumbs in search results.
Review where readers read
Three tests now lock the heading contract. The larger lesson is about my review surface: it rendered the article without the wrapper that production adds, so it approved a page no reader would ever see. If a style only works under one specific ancestor, put the style on the element itself.