π©βπ»Best practices for styling your store
When integrating third-party widgets (like ours), itβs important to avoid style conflicts that can affect their functionality or appearance. Here are some best practices to structure your store's styles safely:
Avoid overly aggressive global resets
Global resets can unintentionally affect widgets, iframes, or external integrations.
β NOT recommended:
* {
all: unset;
}
body, html {
margin: 0;
padding: 0;
font-family: Arial !important;
} β
Recommended
.store * {
box-sizing: border-box;
margin: 0;
padding: 0;
} Donβt force global fonts
Changing the global font affects the entire DOM, including embedded widgets or libraries.
β NOT recommended:
β
Recommended
Control style specificity
Avoid overriding generic classes like .modal, .popup, or .overlay without proper context.
β NOT recommended:
β
Recommended
Handle z-index properly
Improper use of z-index can cause unexpected overlaps with widgets or other components.
β NOT recommended:
β
Recommended
Avoid global styles on base elements
Overriding basic HTML tags can affect widgets or third-party components.
β NOT recommended:
β
Recommended
Use CSS variables for themes and colors
β NOT recommended:
β
Recommended
Use prefixed class names to avoid conflicts
Using common class names like .button, .icon, or .container without a namespace increases the risk of CSS collisions.
β NOT recommended:
β
Recommended
Maintaining clean and well-scoped CSS is essential when working with third-party widgets or embedded components. Following these best practices helps ensure:
Your storeβs styles remain consistent and predictable.
Third-party integrations work as expected, without visual or functional conflicts.
Maintenance becomes easier, reducing technical debt and avoiding hard-to-debug issues in the future.
Last updated