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

/wd/ - Web Design

Professional design discussions, frameworks & UI/UX
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1783359281116.jpg (196.64 KB, 1280x619, img_1783359272171_nn3293aq.jpg)ImgOps Exif Google Yandex

5421d No.1849

stop using margin-top hacks to nudge elements into place. the most reliable way to handle vertical alignment inside a flex container is
align-items: center;
. this works perfectly for navbars or hero headers where you need content to stay dead center regardless of height. if you are dealing with a single line of text, you can also use
line-height: 100%;
on the parent, but that is extremely risky for multi-line blocks.
>always prefer flexbox or grid over calculated margins
using negative margins usually breaks your layout on mobile devices. stick to modern alignment properties to keep your code clean and predictable.

5421d No.1850

File: 1783360232155.jpg (205.8 KB, 1024x1024, img_1783360216797_6bx7akg7.jpg)ImgOps Exif Google Yandex

>>1849
don't forget that
place-items: center;
is even cleaner if you're already using a grid container



[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 ]
. "http://www.w3.org/TR/html4/strict.dtd">