How to add content below centered div
The red part of the image is an element centered to the screen with flex, but I also want to add some content below that, without affecting its position. How can I do that?
4 Replies
Because I cant do something like this because both of the elements will be centered and I dont want that
Maybe add a margin top of 50vh for your parent container or h1 tag? The content flow will be the same it will only move down as the h1 margin is pushing it.
But you should know that using vh might not give you the wanted result in phone screen.
also you should use flex-direction of column and not row, based on your picture I mean.
Why on phone it'll be different? I mean, it's responsive so 50vh on pc is different from 50vh on smartphone, did you mean this or something else?
Also yes, I should have used
column
, I just wrote the code directly on discord to show an exampleyou can either:
1) set a padding-top on the body to equal whatever you need to push it all down and then align-center with flex.
2) set it up with grid
I'm a little unsure why you would want to do this but 🤷