html - CSS 3 行,第一行固定大小,最后一行固定大小,居中休息

标签 html css user-interface

我想放 3 行 1-第一个有固定的高度 2- second 具有灵活的剩余尺寸但问题是第三行,因为它在某些情况下发现并且我希望在所有情况下第二个都采用剩余尺寸 3- third if founded 采取固定高度

enter image description here

仅供引用:容器行具有固定高度

.container
{
  height: 300px;
  display: flex;
  flex-direction: column;
}

.row-1
{
  height: 50px;
}

.row-2
{
}

.row-3
{
  height: 50px; 
}

最佳答案

如果你对使用 flex 没问题,可以这样实现:

.container
{
  height: 200px;
  display: flex;
  flex-direction: column;
}

.firstRow
{
  height: 50px;
  background-color: blue;
}

.secondRow
{
  background-color: red;
  flex: 1;
}

.thirdRow
{
  height: 30px;
  background-color: yellow;
}
<div class="container">
  <div class="firstRow"></div>
  <div class="secondRow"></div>
  <div class="thirdRow"></div>
</div>

关于html - CSS 3 行,第一行固定大小,最后一行固定大小,居中休息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53079013/

相关文章:

php - wordpress 管理页面

html - 文本输入字段在 safari 中不起作用

css - 父/子样式 css

python - 在后台运行基于 GUI 的应用程序的 .exe

java - 无法在java中的jscrollPane中将组件添加到jpanel

python - wxPython 中的 sendMessage() takes at most 3 arguments (4 given) 错误

html - 如何在 Bootstrap 的容器内创建一个 100% 屏幕宽度的 div?

html - 表格正文部分的滚动属性不起作用

css - 需要为 html5 注释 Canvas 应用程序制作固定间距字体的建议

html - 如何使用 css 将三 Angular 形 “^” 放置在内容框的顶部?