@kkalvaa
Posted
The simplest way to align anything vertically is with flexbox and "align-items: center;", You can do the same with grid, but it doesn't make sense to go grid for just one element.
Marked as helpful
Looking to hire developers?
Submitted
@Filippo-B
I wrote a simple function in SCSS to convert any px value into rem. I would like to have some feedbacks on that. Also, often I have difficulties centering the main container vertically. What method do you use? Thanks.
@kkalvaa
Posted
The simplest way to align anything vertically is with flexbox and "align-items: center;", You can do the same with grid, but it doesn't make sense to go grid for just one element.
Marked as helpful
@david688888
Posted
to align the flex item vertically, first you need to adjust the flex container height. im using vh css unit for my code. i set it to min100vh because 100vh = your device screen height, so the height of the flex container is automatically adjusted to your screen height. Im sorry for the bad explaination because im not from a english speaking country
heres some resource: https://www.w3schools.com/cssref/css_units.asp https://www.w3schools.com/css/tryit.asp?filename=trycss3_align_flex
@Filippo-B
Posted
@david688888 That's clear enough, thank you!
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord