, , , , ? Flexbox , box-sizing: border-box. 10px . .
DEMO 2 OP, Michael_B, . , . 5 10. :
.container .boxes 1000vh 1000% ..container position: relative; .box position: absolute;.box z-index 10 . № 1 - z-index: 10;, № 2 - z-index: 20; ..;
:
@charset "utf-8";
html, body { box-sizing: border-box; font: 400 16px/1.45 'Source Code Pro'; width: 100vw; height: 100vh; }
*, *:before, *:after { box-sizing: inherit; margin: 0; padding: 0; border: 0; outline: none; }
body { background: #121; color: #FEF; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; position: relative; }
DEMO 1
:
border: 10px... outline: 10px...
DEMO 2
:
justify-content: center; .container
flex: 1 0 auto; .box
:
flex-direction: row; flex-flow: row nowrap
DEMO 1
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>flexBox</title>
<style>
@charset "utf-8";
html,
body {
box-sizing: border-box;
font: 400 16px/1.45'Source Code Pro';
width: 100vw;
height: 100vh;
}
*,
*:before,
*:after {
box-sizing: inherit;
margin: 0;
padding: 0;
border: 0;
outline: none;
}
body {
background: #121;
color: #FEF;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
}
.container {
display: flex;
outline: 10px solid goldenrod;
min-height: 100vh;
flex-direction: row;
}
.box {
color: white;
font-size: 100px;
text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
padding: 10px;
}
.box1 {
background: #1abc9c;
}
.box2 {
background: #3498db;
}
.box3 {
background: #9b59b6;
}
.box4 {
background: #34495e;
}
.box5 {
background: #f1c40f;
}
.box6 {
background: #e67e22;
}
.box7 {
background: #e74c3c;
}
.box8 {
background: #bdc3c7;
}
.box9 {
background: #2ecc71;
}
.box10 {
background: #16a085;
}
</style>
</head>
<body>
<div class="container">
<div class="box box1">1</div>
<div class="box box2">2</div>
<div class="box box3">3</div>
<div class="box box4">4</div>
<div class="box box5">5</div>
<div class="box box6">6</div>
<div class="box box7">7</div>
<div class="box box8">8</div>
<div class="box box9">9</div>
<div class="box box10">10</div>
</div>
</body>
</html>
Hide resultDEMO 2
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>flexBox</title>
<style>
@charset "utf-8";
html,
body {
box-sizing: border-box;
font: 400 16px/1.45'Source Code Pro';
width: 100vw;
height: 100vh;
}
*,
*:before,
*:after {
box-sizing: inherit;
margin: 0;
padding: 0;
border: 0;
outline: none;
}
body {
background: #121;
color: #FEF;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
position: relative;
}
.container {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
display: flex;
outline: 10px solid goldenrod;
min-height: 1000vh;
flex-flow: column nowrap;
justify-content: center;
align-content: baseline;
align-items: space-around;
}
.box {
color: white;
font-size: 6em;
text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
padding: 1em;
flex: 1 0 101vh;
border: 10%;
overflow: auto;
height: 1000%;
}
.box1 {
background: #1abc9c;
z-index: 10;
}
.box2 {
background: #3498db;
z-index: 20;
}
.box3 {
background: #9b59b6;
z-index: 30;
}
.box4 {
background: #34495e;
z-index: 40;
}
.box5 {
background: #f1c40f;
z-index: 50;
}
.box6 {
background: #e67e22;
z-index: 60;
}
.box7 {
background: #e74c3c;
z-index: 70;
}
.box8 {
background: #bdc3c7;
z-index: 80;
}
.box9 {
background: #2ecc71;
z-index: 90;
}
.box10 {
background: #16a085;
z-index: 100;
}
</style>
</head>
<body>
<div class="container">
<div class="box box1">1</div>
<div class="box box2">2</div>
<div class="box box3">3</div>
<div class="box box4">4</div>
<div class="box box5">5</div>
<div class="box box6">6</div>
<div class="box box7">7</div>
<div class="box box8">8</div>
<div class="box box9">9</div>
<div class="box box10">10</div>
</div>
</body>
</html>
Hide result