CSS:上面固定高度、下面填充满,上面消失,下面仍然填充满

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  html, body {
  height: 100%;
  margin: 0;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%; /* 使用最小高度来确保占据整个屏幕 */
}

.top {
  height: 100px;
  background-color: lightgray;
}

.bottom {
  flex-grow: 1;
  background-color: lightblue;
}
</style>
<body>
  <div class="container">
    <div class="top">上</div>
    <div class="bottom">下</div>
  </div>
</body>
</html>
相关推荐
小桥风满袖4 分钟前
Three.js-硬要自学系列7 (查看几何体顶点位置和索引、旋转,缩放,平移几何体)
前端·css·three.js
换日线°5 分钟前
微信小程序文字混合、填充动画有效果图
css·微信小程序
梦雨生生1 小时前
拖拉拽效果加点击事件
前端·javascript·css
前端Hardy1 小时前
HTML&CSS:全网最全的代码时钟效果
javascript·css·html
前端Hardy1 小时前
HTML&CSS:看这里,动态背景卡片效果
javascript·css·html
雪碧聊技术3 小时前
使用HTML + CSS + JS,编写一个台球追分计分器
前端·javascript·css·html·台球计分器
小桥风满袖3 小时前
Three.js-硬要自学系列5 (顶点位置数据和点模型、线模型、网格模型)
前端·css·three.js
Z_ One Dream3 小时前
Unocss 类名基操, tailwindcss 类名
css
袋鼠云数栈前端3 小时前
AI 大模型科普-概念向
css·sandbox
土豆12504 小时前
Flex布局中的溢出滚动问题解决指南
前端·css