首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何在CSS中设置自动高度的最大高度?

如何在CSS中设置自动高度的最大高度?
EN

Stack Overflow用户
提问于 2016-08-26 17:41:36
回答 2查看 16.9K关注 0票数 1

我想设置div的最大高度,设置高度自动,就像在代码下一样。

.background.left-sidebar {
  height: auto !important;
  padding-bottom: 0;
  right: 0;
  width: 300px;
  background-color: #999999;
  margin-top: 40px;
  margin-right: 300px;
}

.left-sidebar {
  height: auto;
  width: 300px;
  padding-bottom: 0px;
}

.left-sidebar-top {
  width: 100%;
  height: 300px;
  background-color: #996699;
}

  <div class="right_block left-sidebar">
    <div class="content">
      <div class="top_block left-sidebar-top">
        <div class="content">
        </div>
      </div>
      <div class="marker">This</div>
    </div>
  </div>

我尝试设置height:100%height:auto,但它不起作用。

如何在CSS中设置自动高度的最大高度?

Plunker

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39163244

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档