Kyle Shevlin 2/26/2024

No Outer <code>margin</code>

Read Original

This article discusses a common anti-pattern in front-end development: applying margin or padding to the outermost element of a reusable component. It explains how this breaks encapsulation, forces 'compensations' in other components, and incorrectly makes a component responsible for external spacing. The author provides code examples and advocates for components to only manage their internal layout.

No Outer <code>margin</code>

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

1
The Beautiful Web
Jens Oliver Meiert 2 votes
3
LLM Use in the Python Source Code
Miguel Grinberg 1 votes
4
Wagon’s algorithm in Python
John D. Cook 1 votes