Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Master CSS Spacing: Margin, Padding, and Gap Explained

CSS

CSS spacing

margin

padding

gap

CSS margin

CSS padding

CSS gap

web development

frontend development

responsive design

CSS layout

CSS tips

CSS tricks

coding tutorial

web design

CSS demo

flexbox

CSS grid

UI design

UX design

web design tutorial

frontend tutorial

coding tips

coding best practices

web development tips

CSS properties

HTML CSS

CSS tutorial

learn CSS

web development tutorial

UI/UX tips

Автор: Dmitry Mayorov

Загружено: 4 июн. 2024 г.

Просмотров: 2 192 просмотра

Описание:

In one of my videos, I said, 'Never use margins on reusable components!' Some of you asked, 'How do you create space then?' This video answers that. Plus, I'll break down how to choose between margin, padding, and gap in CSS with a real-world example – It's not always straightforward. Let's dive in!

CodePen Before: https://codepen.io/dmtrmrv/pen/GRajVRx
CodePen After: https://codepen.io/dmtrmrv/pen/rNgjmPp

Margin is the easiest to understand. Adding margin to an element creates space outside of it, pushing it away from other elements. Padding adds space between the edge of the element and its content. By adding padding, you ensure that regardless of the element's content, there is always consistent spacing inside.

Gap is a newer property that allows you to create space between elements within a flexbox or grid container. It's super handy, but not always the best choice for every scenario. Real projects are more nuanced, and knowing when to use margin over gap, or padding over margin, is key.

I'll walk you through a realistic example to show how to choose the right CSS spacing property. We'll start with a layout that needs spacing adjustments, and by the end, you'll know exactly how to pick the right property for each use case. CodePens are provided so you can practice along.

We'll fix spacing issues by adding consistent site gutters using padding, ensuring vertical spacing in the header and footer, and deciding between margin and gap for different components. I'll explain why I prefer certain approaches, and you'll learn tips like using the lobotomized owl selector for better vertical rhythm and enhancing navigation accessibility with padding.

By the end of this video, you'll have a clear understanding of how to use margin, padding, and gap in CSS to create well-spaced, professional layouts. Whether you're a beginner or looking to refine your skills, this tutorial will provide practical insights and techniques to enhance your CSS proficiency.

00:00 – Introduction
00:18 – Margin
00:56 – Padding
01:50 – Gap
02:34 – Better Demo
03:10 – Creating Consistent Site Gutters
04:16 – Enhancing Vertical Space in Headers and Footers
05:27 – Spacing Between Layout Sections
06:24 – Never Use Margins on Blocks (Again)
07:27 – Vertical Rhythm with Smart Spacing
10:39 – Using Gap for a Neat Card Grid
11:09 – Fine-Tuning Spacing Inside Cards
13:33 – Improving Navigation Accessibility with Padding

Get updates about new videos in your inbox → https://tinyurl.com/yuu8x8my
Follow me on Twitter:   / dmtrmrv  

Master CSS Spacing: Margin, Padding, and Gap Explained

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Master CSS Units: Pixels, REMs, & EMs

Master CSS Units: Pixels, REMs, & EMs

Make Sense of Box-Sizing in CSS (and avoid this major mistake!)

Make Sense of Box-Sizing in CSS (and avoid this major mistake!)

CSS Flexbox - Часть 2 - Align-items, Justify-content, Align-content, Align-self

CSS Flexbox - Часть 2 - Align-items, Justify-content, Align-content, Align-self

This One Thing Causes Most CSS Issues! (learn how to avoid it)

This One Thing Causes Most CSS Issues! (learn how to avoid it)

Refactoring Old CSS with AI!

Refactoring Old CSS with AI!

CSS Tip: Extend a Child Beyond Parent Width (the better way)

CSS Tip: Extend a Child Beyond Parent Width (the better way)

Is Mobile-First Design Still Relevant in 2025?

Is Mobile-First Design Still Relevant in 2025?

Don't Use @layer in CSS! (until you know these two things)

Don't Use @layer in CSS! (until you know these two things)

CSS Vertical Spacing: Margins vs. Gaps Explained

CSS Vertical Spacing: Margins vs. Gaps Explained

Building an Article Layout with CSS Grid—Worth It?

Building an Article Layout with CSS Grid—Worth It?

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]