S
S
Skrolea2016-06-29 22:26:28
css
Skrolea, 2016-06-29 22:26:28

Why is the element not centered?

I'm making a modal in flexbox. div inside is not centered. Why?

<div class="header__menu">
                <div class="menu__button" id="menu_button">
                 open
                </div>               
  </div>
  <div class="menu-wrapper" id="topMenuWindow">
                <div class="menu-window">
                    Текст текст текст текст текст текст                    
                </div>
    </div>

with styles
.menu-wrapper {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-line-pack: center;
    align-content: center;
    position: fixed;
    top: 0; left: 0;
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.1);
    display: none;
    z-index:3;
}
.menu-window {
    background:white;
    height:200px;
    width:200px;
}

Example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Fedorov, 2016-06-29
@aliencash

.menu-wapper {
 width: 100vw;
 height: 100vh;
}
.menu-window {
 margin: auto auto;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question