← 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.

Full library access

Unlock every article — and keep reading each month

Create a free account, pick a plan that fits how you read, and use monthly credits for deep dives on engineering, products, and founder reality. Cancel or switch anytime from your profile.

Get the newsletter

Posts and notes straight to your inbox

Get new posts and short notes by email — no spam, unsubscribe anytime. We also email when new free articles go live.