首页htmlbottomCSS Layout - 如何强制DIV块扩展到页面的底部,即使它没有内容

CSS Layout - 如何强制DIV块扩展到页面的底部,即使它没有内容

我们想知道如何强制DIV块扩展到页面的底部,即使它没有内容。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
html, body {
  height: 100%;
  display: flex;
  flex-direction: column;
}

body>* {
  flex-shrink: 0;
}

.div1 {
  background-color: #EEE;
}

.div2 {
  background-color: #DDD;
}

.div3 {
  background-color: #CCC;
  flex-grow: 1;
}
</style>
</head>
<body>
  <div class=div1>
    div1<br> div1<br> div1<br>
  </div>
  <div class=div2>
    div2<br> div2<br> div2<br>
  </div>
  <div class=div3>
    div3<br> div3<br> div3<br>
  </div>
</body>
</html>