Tom Smykowski beta

Blog

🌤️ Stop Using Margin Top. Use Margin Bottom And Gap Instead

🌤️ Stop Using Margin Top. Use Margin Bottom And Gap 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 efficient frontend development practices and creating maintainable codebases.

What This Article Covers

In this article, Tom Smykowski delves into the common pitfalls of using margin-top in CSS and advocates for a more systematic approach using margin-bottom and gap. It explores how adhering to a top-to-bottom flow in styling can enhance the readability and maintainability of your code, especially in complex component-based frameworks like React or Angular.

Questions This Article Answers

  • Why is margin-top considered less effective in CSS styling?
  • How can using margin-bottom and gap improve code maintainability?
  • What are the benefits of a top-to-bottom flow in CSS?
  • How does this approach affect component-based development in frameworks like React and Angular?
  • What practical examples illustrate the advantages of this styling method?

Length and Time

A practical guide with insightful examples and best practices. Approximately 7 minutes to read.

Want to unlock the full story? Log in

← All posts