Из-за <br>,
вы не можете выровнять элементы.Вы можете попробовать это, используя span
По горизонтали
html {
height: 100%;
width: 100%;
}
body {
display: flex;
flex-direction: column;
align-items: stretch;
height: 100%;
width: 100%;
margin: 0;
background-color: grey;
}
header {
background-color: green;
height: 3em;
flex: 0 0 auto;
}
main {
display: flex;
flex: 1 1 auto;
overflow: hidden;
background-color: yellow;
}
nav {
flex: 0 0 100px;
overflow: auto;
background-color: grey;
}
#wrapper {
flex: 1 1 auto;
display: flex;
flex-direction: column;
background-color: red;
}
#content {
align-items: center;
flex: 1 1 auto;
overflow: auto;
background-color: white;
display: flex;
}
span {
padding: 5px;
}
footer {
height: 1em;
flex: 0 0 auto;
background-color: blue;
}
<header>header</header>
<main>
<nav></nav>
<div id="wrapper">
<div id="content">
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>10</span>
<span>11</span>
<span>12</span>
<span>13</span>
<span>14</span>
<span>15</span>
<span>16</span>
<span>17</span>
<span>18</span>
<span>19</span>
<span>20</span>
</div>
<footer></footer>
</div>
</main>
Для вертикальной попытки эта надежда поможет вам.
html {
height: 100%;
width: 100%;
}
body {
display: flex;
flex-direction: column;
align-items: stretch;
height: 100%;
width: 100%;
margin: 0;
background-color: grey;
}
header {
background-color: green;
height: 3em;
flex: 0 0 auto;
}
main {
display: flex;
flex: 1 1 auto;
overflow: hidden;
background-color: yellow;
}
nav {
flex: 0 0 100px;
overflow: auto;
background-color: grey;
}
#wrapper {
flex: 1 1 auto;
display: flex;
flex-direction: column;
background-color: red;
}
#content {
flex: 1 1 auto;
overflow: auto;
background-color: white;
display: flex;
flex-direction: column;
}
span {
padding: 5px;
}
footer {
height: 1em;
flex: 0 0 auto;
background-color: blue;
}
<header>header</header>
<main>
<nav></nav>
<div id="wrapper">
<div id="content">
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
<span>6</span>
<span>7</span>
<span>8</span>
<span>9</span>
<span>10</span>
<span>11</span>
<span>12</span>
<span>13</span>
<span>14</span>
<span>15</span>
<span>16</span>
<span>17</span>
<span>18</span>
<span>19</span>
<span>20</span>
</div>
<footer></footer>
</div>
</main>
Если вы хотите выровнять по центру по вертикали, добавьте это align-items: center;