Search keyword highlights use em elements nested inside span elements within article content. When a knowledge base applies custom CSS targeting .main-content span to control typography a common pattern for setting a consistent body font size those rules unintentionally override the highlight’s inherited formatting, including inside headings, where the highlighted word loses its heading size and weight.
Apply defensively scoped CSS to highlight elements - for example, by explicitly inheriting font properties on the highlight container or by using a namespaced CSS class with higher specificity - so that user CSS rules targeting common inline selectors do not affect the visual appearance of search highlights in headings and other formatted elements.
Benefit: Search keyword highlights preserve the native formatting of their surrounding content - headings stay the correct size and weight, inline text keeps its styling - regardless of custom CSS rules applied to the knowledge base site. Teams that style their knowledge base using custom CSS can do so freely without having to audit their selectors for accidental highlight override.