How to make the text touch the bottom of the div

后端 未结 1 1038
时光说笑
时光说笑 2021-01-23 20:08

I have an HTML page with somewhat large text elements. I want the text to align to the bottom of the containing div so that it touches the bottom of the div.

I tried fol

相关标签:
1条回答
  • 2021-01-23 20:40

    You can do this with line-height

    .bottomAlignedText {
      position: relative;
    }
    .bottomAlignedText span {
      position: absolute;
      bottom: 0;
      left: 0;
      line-height: 0.7;
    }
    <body>
    <div class="bottomAlignedText" style="width: 600px; height: 600px; border: 1px solid;">
        <span style="font-size:300px;">Test</span>
    </div>
    </body>

    0 讨论(0)
提交回复
热议问题