Tom Smykowski beta

Blog

Stop Using CSS Margin And Padding Shorthands. Use This Instead

Stop Using CSS Margin And Padding Shorthands. Use This Instead

Hi, my name is Tom Smykowski, I'm a staff full-stack engineer. I build and scale SaaS platforms to millions of users, working end-to-end from system architecture to frontend to mobile. On this blog I share what I learn about modern web development practices and improving code maintainability.

What This Article Covers

Explore the intricacies of CSS margin and padding shorthands and discover why these seemingly convenient features may not be the best choice for web development. This article delves into the challenges of using shorthands, potential pitfalls, and a more effective approach to handle spacing in CSS.

Questions This Article Answers

  • What are the common issues with using CSS margin and padding shorthands?
  • How do shorthand properties complicate design changes and maintenance?
  • Why might fully named CSS properties be a better alternative?
  • What are the cognitive challenges associated with interpreting shorthand syntax?
  • How can developers improve code readability and reduce errors in CSS?

Length and Time

A practical exploration with insights from real-world projects. Approximately 7 minutes to read.

Want to unlock the full story? Log in

← All posts