πŸ‘©β€πŸ’»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.

 * {
   all: unset;
  }

  body, html {
    margin: 0;
    padding: 0;
    font-family: Arial !important;
  }  
.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.

Control style specificity

Avoid overriding generic classes like .modal, .popup, or .overlay without proper context.

Handle z-index properly

Improper use of z-index can cause unexpected overlaps with widgets or other components.

Avoid global styles on base elements

Overriding basic HTML tags can affect widgets or third-party components.

Use CSS variables for themes and colors

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.

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