0

I'm trying to place my both divs that are in the flexbox container in the middle of the screen. I tried with margin top and things like that, but I want them just in the middle of the page.

.flexbox-container
    display: flex
    justify-content: center
    flex-direction: row
    flex-wrap: wrap
    min-height: 100%
    align-self: center

.flexbox-item
    width: 500px
    margin: 100px 60px
    background-color: white

.flexbox-item-1
    min-height: 500px


.flexbox-item-2
    min-height: 500px

3 Answers3

1

Solved! I give HTML and Body tags a "height: 100%" and perfect, placed in the middle of the screen!

0

You are almost there, just missing align-items in the container.

.flexbox-container {
    display: flex;
    justify-content: center;
    flex-direction: row;
    flex-wrap: wrap;
    min-height: 100%;
    align-items: center;
}
Jarek Danielak
  • 394
  • 4
  • 18
0

Use align-items.

.flexbox-container
    display: flex
    justify-content: center
    flex-direction: row
    flex-wrap: wrap
    min-height: 100%
    align-self: center
    align-items:center

.flexbox-item
    width: 500px
    margin: 100px 60px
    background-color: white

.flexbox-item-1
    min-height: 500px


.flexbox-item-2
    min-height: 500px
atultw
  • 921
  • 7
  • 15