CSS - 根据内容改变高度

标签 css

我有 3 个框,我需要根据内容更改高度,但高度必须更改为向上(下边距对齐)。这是图像的外观: enter image description here

<style>
  .wrapper{
    width: 100%;
    height: 30px;
  }

  .wrapper .point{
    width: 12px;
    height: 12px;
    background: #979797;
    -moz-border-radius: 70px;
    -webkit-border-radius: 70px;
    border-radius: 70px;
    float: left;
    margin-top: 3px;
  }

  .wrapper .text{
    width: 130px;
    float: left;
    border-bottom: 2px solid #979797;
    color: #979797;
    font-size: 11px;
    min-height: 20px;
    text-align: center;
    padding-bottom: 20px;
    margin-top: -12px;
  }
</style>


<div class="wrapper">
  <div class="point"></div>
  <div class="text">Short</div>
  <div class="point"></div>
  <div class="text">Short</div>
  <div class="point"></div>
  <div class="text">Very long text. Lorem ipsum dolor sit amet</div>
  <div class="point"></div>
</div>

怎么做?谢谢

最佳答案

尝试

height:auto,
width:100%

在你的 CSS 中

关于CSS - 根据内容改变高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45628140/

相关文章:

css - 在居中图像的一侧有一个图形标题

javascript - 如何在 html5 css3 中创建 Angular div

css - 忽略所有父 css 的 HTML 元素

php - 在marquee中显示mysql数据

javascript - 我的站点使用 "defer"进行快速加载,但破坏了 Opera Mini 的站点,有什么解决方法吗?

html - 位置绝对 div 显示在 PDF 文件下方

CSS 背景大小填充父级

javascript - 使用 <text-shadow> 效果更改文本颜色

jquery - 将 css 运行时添加到表行和数据绑定(bind)行

javascript - 设置 innerHTML 之间的转换