Div is not occupying 100% of the page height

Asked

Viewed 46 times

0

I’m using React.js + next.js + Styled Components to develop the front of an app. In my Layout file I have a Wrapper that makes the other two div’s (Leftcontainer and Rightcontainer) stand next to each other, but neither div’s occupies 100% of the page height. I am attaching below both the Layout class and that of its styling.

export default function Layout({ children }) {
    return (
        <>
            <Wrapper>
            <LeftContainer>
                a
            </LeftContainer>
            <RightContainer>
                a
            </RightContainer>
            </Wrapper>
        </>
    )
}
import styled from 'styled-components'

export const Wrapper = styled.div `
    display:flex;
    flex-direction:row;
    height:100%;
    min-height:100%;
`

export const LeftContainer = styled.div `
    display:flex;
    flex-direction: column;
    width:100%;
    //background-color: ${(props) => props.theme.colors.secondary};
    background-color:black;
`

export const RightContainer = styled.div `
    display:flex;
    flex-direction: column;
    //background-color: ${(props) => props.theme.colors.primary};
    background-color:red;
    width:100%;
`
  • Try: height:100vh

  • This way you will get the full page size, using the 100% you may have problems, if the div is inside another

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.