I'm having trouble getting this to work properly. I am using React and styled components, but the justify/content alignment is not functioning as expected.
The setup includes a div with flex properties, where the flex direction is set to column. Within this div, there is a header div and a body div with the flex-grow property set to 1 to ensure it takes up the full height of the container.
Although the body element occupies the full height as intended, I'm struggling to center the content vertically within this div. I have attempted various combinations of aligning and justifying on both the parent and body divs, without success - and I'm unsure why that might be.
Here's my code:
const Div = styled.div`
display: flex;
flex-direction: column;
min-height: 100vh;
justify-self: center;
& > * :nth-child(2){
flex-grow: 1;
background-color: red;
}
`
const OuterWrapper = styled.div`
padding: 10vw 1.5rem;
overflow: hidden;
// This div contains the content I want to center
Any insights into why it's not working?