Add custom CSS to style A2Reviews widgets
Most of the widget design can be changed with the built-in settings: colors, fonts, borders, layouts and more. When you need something those settings can't do, such as fixing spacing that clashes with your theme, you can add your own CSS in the Custom CSS editor.
Open the Custom CSS editor
- Go to Settings > Reviews (or Settings > Questions).
- Click the Custom CSS icon in the page heading, next to the Settings title. The Custom CSS panel opens.
- On Shopify, use Select theme to choose which theme the CSS applies to. Your published theme is marked Live, and Online Store 2.0 themes are labeled.
Custom CSS is saved separately for each Shopify theme. If you are preparing a new theme before publishing it, select that theme and add its CSS too.
Add and save your CSS
- Type or paste your CSS into the editor.
- Optionally open the code snippets list to insert a ready-made fix. Examples include "Fix stars rating heigh on Warehouse" for the Warehouse theme and "Fix SVG global" for star icons that display at the wrong size.
- Click CSS Beautify to tidy the formatting.
- If the Errors console shows problems, open Errors Details and fix them.
- Click Save Change. You will see "The CSS code has been updated successfully."
If you close the panel without saving, you'll be warned that your changes will be lost.
Example
This example adds space around the star rating under product titles and makes the review count text slightly smaller:
/* Space around the star rating under product titles */
a2-reviews-total {
display: block;
margin-top: 8px;
margin-bottom: 8px;
}
/* Smaller star icons in the rating badge */
.a2-avg-rating .a2-avg-active > span svg,
.a2-avg-rating .a2-avg-bg > span svg {
width: 16px;
height: auto;
}
Tip: To find the right selector, right-click the element on your storefront and choose Inspect in your browser. A2Reviews elements usually have names starting with a2.
Good practices
- Try the built-in options first (see Review Widget and Star Ratings & Badges). Settings carry over when the widget is updated, and they're easier to change later.
- Keep selectors specific so your CSS doesn't affect other parts of your theme.
- Add a short comment above each rule so you remember why you added it.
- Use
!important only when a rule otherwise has no effect.
- Check your changes on both desktop and mobile.
- After switching themes, re-check your CSS. The new theme may need different rules, and it has its own Custom CSS.
Troubleshooting
- Changes don't show: check that you saved the CSS for the Live theme, then reload the storefront in a private window.
- Layout broke after saving: remove the last rule you added and save again, or clear the editor and save to go back to no custom CSS.
Related articles: Review Widget, Review Blocks, Social Proof Popups.