Your app's existing CSS continues to work exactly as before.
When you render a diff using HTML Diff, it only adds data-diff-status attributes to highlight changes. It does not modify your existing HTML structure or styling. The exception is when you opt in to specific behaviors using data-diff-mode attributes, which allows for more control over how diffs are displayed.
Each changed element receives one of these attributes:
data-diff-status="added" — applied to newly added elementsdata-diff-status="modified" — applied to modified elementsdata-diff-status="removed" — applied to removed elementsNotice how:
primary-btn and large-size classes remain untouchedid and data-diff-key attributes are preserveddata-diff-status="modified" was added to highlight the change.primary-btn and .large-size continues to workA default stylesheet is provided with the package:
Or, add it to your HTML:
You can override these styles in your own CSS for custom themes or branding:
Because diff metadata is attached via data-diff-status, your components keep their original classes intact. You simply target the attribute in CSS:
You can now scope your override styles with attribute selectors without worrying about class ordering.
Attribute selectors have the same specificity as classes, so you can rely on normal cascade rules:
This ensures your app's layout and design remain intact while only the diff highlighting is added on top.