How to align content of a div to the bottom

后端 未结 26 2556
挽巷
挽巷 2020-11-22 01:13

Say I have the following CSS and HTML code:

26条回答
  •  误落风尘
    2020-11-22 02:00

    Inline or inline-block elements can be aligned to the bottom of block level elements if the line-height of the parent/block element is greater than that of the inline element.*

    markup:

    I'm at the bottom

    css:

    h1.alignBtm {
      line-height: 3em;
    }
    h1.alignBtm span {
      line-height: 1.2em;
      vertical-align: bottom;
    }
    

    *make sure you're in standards mode

提交回复
热议问题