Based on examples at https://philipwalton.github.io/solved-by-flexbox/
A Pen by Michael Garten on CodePen.
Based on examples at https://philipwalton.github.io/solved-by-flexbox/
A Pen by Michael Garten on CodePen.
<body class="app"> | |
<header class="app-header">Header</header> | |
<div class="app-body"> | |
<main class="app-content">Main</main> | |
<nav class="app-nav">Nav</nav> | |
<aside class="app-ads">Ads</aside> | |
</div> | |
<footer class="app-footer">Footer</footer> | |
</body> |
.app { | |
display: flex; | |
min-height: 100vh; | |
flex-direction: column; | |
text-align: center; | |
color: #35495E; | |
font-weight: bold; | |
margin: 0; | |
padding: 0; | |
} | |
.app-header { | |
border: 1px solid #ccc; | |
padding: 1%; | |
background: #41B883; | |
} | |
.app-footer { | |
border: 1px solid #ccc; | |
padding: 1%; | |
background: #41B883; | |
} | |
.app-body { | |
display: flex; | |
flex: 1; | |
background: #41B883; | |
} | |
.app-content { | |
flex: 1; | |
border: 1px solid #ccc; | |
background: #35495E; | |
color: #ddd; | |
} | |
.app-nav, .app-ads { | |
/* 12em is the width of the columns */ | |
flex: 0 0 12em; | |
border: 1px solid #ccc; | |
padding: 1%; | |
background: #35495E; | |
color: #ddd | |
} | |
.app-nav { | |
/* put the nav on the left */ | |
order: -1; | |
} | |
.app-body { | |
display: flex; | |
flex-direction: column; | |
} | |
.app-nav { | |
order: -1; | |
} | |
@media (min-width: 768px) { | |
.app-body { | |
flex-direction: row; | |
flex: 1; | |
} | |
.app-content { | |
flex: 1; | |
} | |
.app-nav, .app-ads { | |
/* 12em is the width of the columns */ | |
flex: 0 0 12em; | |
} | |
} |