Html 100% Height With Multiple Inline Scrolling Divs
I am trying to achieve this layout: Page is 1200px wide and centered Page fills 100% of the browser's height Page does not scroll The green and red divs should have inline scroll
Solution 1:
Using flexbox model make your design more easy. Look here:
html, body {
height: 100%;
width: 100%;
}
html {
background-color: rgb(160,160,100);
}
body {
padding: 0;
margin: 0;
}
main {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-content: stretch;
align-items: stretch;
max-width: 1200px;
margin: 0 auto;
height: 100%;
}
header {
min-height: 40px;
flex: 0040px;
background-color: rgba(100, 100, 0, 0.4);
overflow: hidden;
}
nav {
min-height: 80px;
flex: 0080px;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-content: stretch;
align-items: stretch;
}
.logo {
min-width: 80px;
flex: 00 auto;
background-color: yellow;
overflow: hidden;
}
.nav-wrapper {
flex: 11 auto;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
justify-content: flex-start;
align-content: stretch;
align-items: stretch;
}
.nav-wrapper > div {
flex: 11 auto;
overflow: hidden;
}
.nav-wrapper > div:first-child {
background-color: blue;
}
.nav-wrapper > div:last-child {
background-color: grey;
}
.main {
flex: 11 auto;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-content: stretch;
align-items: stretch;
overflow: auto;
}
.main > div {
flex: 1150%;
line-height: 3em;
align-self: auto;
overflow: auto;
}
.main > div:first-child {
background-color: rgba(255, 0, 0, 0.4);
}
.main > div:last-child {
background-color: rgba(0, 100, 0, 0.4);
}
<main><header></header><nav><divclass="nav-wrapper"><div></div><div></div></div><divclass="logo"></div></nav><divclass="main"><div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div><div>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
</div></div></main>
Example in CODEPEN
Post a Comment for "Html 100% Height With Multiple Inline Scrolling Divs"