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 marginsusing
negative margins usually breaks your layout on mobile devices. stick to modern alignment properties to keep your code
clean and predictable.