HTML image bottom alignment inside DIV container

后端 未结 4 1726
执笔经年
执笔经年 2020-12-13 17:46

I have a div tag with a fixed height. Most of the images have the same height and width.

I want to align the images at the bottom of the div so that they are nicely

4条回答
  •  青春惊慌失措
    2020-12-13 18:16

    Flexboxes can accomplish this by using align-items: flex-end; with display: flex; or display: inline-flex;

    div#imageContainer {
        height: 160px;  
        align-items: flex-end;
        display: flex;
    
        /* This is the default value, so you only need to explicitly set it if it's already being set to something else elsewhere. */
        /*flex-direction: row;*/
    }
    

    JSFiddle example

    CSS-Tricks has a good guide for flexboxes

提交回复
热议问题