Answer the question
In order to leave comments, you need to log in
Why doesn't height: 100% work for nested elements in Chrome?
HTML code:
<body>
<header>
<!-- всяко-разно -->
</header>
<main>
<div class="main_wrap">
<div class="main_row">
<!-- много чего -->
</div>
</div>
</main>
<footer>
<!-- копирайт и т.д. -->
</footer>
</body>
body{
display: flex;
flex-direction: column;
height: 100vh;
}
header{
flex-shrink: 0;
}
main{
flex: 1 0 auto;
.main_wrap{
height: 100%;
.main_row{
height: 100%;
}
}
}
footer{
flex-shrink: 0;
}
Answer the question
In order to leave comments, you need to log in
add height to main too: 100%
percentage height only works for blocks that have an explicit height.
In general, DeaDSandro is right, I did for main flex: 1 0 80%; and everything worked as expected.
The question, however, was not in this, I wanted to know why the solution described initially did not work only in Chrome ?!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question