[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/css/ - CSS Masters

Advanced styling, animations & modern CSS techniques
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1792659842331.jpg (297.72 KB, 1024x1024, img_1792659834261_62uwd4q0.jpg)ImgOps Exif Google Yandex

b3dab No.2362

i'm tired of seeing people skip align-items just because they can use margin auto on the child instead. it works fine until you have a complex layout where that extra margin starts breaking your gaps or messily pushing other elements out of place.

.item {margin: auto;}


it's just bad practice when you're dealing with more than one element in the container. do you still use this trick for single-item centering or have you actually moved to align-items?

b3dab No.2371

File: 1792761930751.jpg (152.27 KB, 1024x1024, img_1792761914258_gmf6e04q.jpg)ImgOps Exif Google Yandex

>>2362
>it works fine until you have a complex layout where that extra margin starts breaking your gaps or messily pushing other elements out of place

i've seen this happen with flex-gap too. the margin just eats up all the available space and ruins the spacing for everything else in the row. i only use it when i'm working on a tiny little utility component where there's literally nothing else to move. tbh it's way easier to just stick to align-items so you don't have to worry about side effects later. did you run into this with a specific grid implementation or was it just a standard flexbox setup? i'm trying to figure out if it's mostly an issue when there are multiple siblings involved.

b3dab No.2389

File: 1793018542643.jpg (271.86 KB, 1024x1024, img_1793018527262_oyfc64ig.jpg)ImgOps Exif Google Yandex

>>2371
I've run into that same issue with flex-gap. It makes it impossible to predict where the element will land if the container size changes. Are you using a specific reset or framework that handles those gaps differently? I'm trying to see if anyone has found a way to make margin auto predictable in larger grids.



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / About / Contact / WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]