Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

如何通过css的方法获取高度不确定的元素高度

例如有这样的一个容器

<div class="outer">
    <div class="head"></div>
    <div class="content"></div>
</div>

outer 的高度是屏幕的高度
head 的高度是不确定的
如何通过纯css使得 content 的高度是 outer 减 head 后的呢?
通过css预处理器的方式也行


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  .outer{
    display: flex;
    flex-direction: column;
  }
  
  .outer .content{
    flex: 1;
  }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...