Code snippets
How to Add Custom CSS to an A/B Test
★★★ Technical level 3 of 3
Written by Neil Webley · Last updated
Apply scoped visual changes with the Add Style snippet.
What you need to know
Replace the sample selector with a stable, narrow selector. Keep CSS in the variant that needs it and avoid affecting navigation or consent controls.
How to use it safely
Check breakpoints, keyboard focus and contrast. Use Remove Style with exactly the same CSS identifier if the state must be restored.
Before publishing
- Use Staging to test control and every variant.
- Check matching and non-matching locations.
- Verify mobile, desktop, accessibility and analytics behaviour.
- Ask someone else to review the setup.