How do you vertically align images within a list or a div?

后端 未结 3 1309
星月不相逢
星月不相逢 2021-02-19 08:00

I have the following code for showing some images:

HTML:

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-19 08:56

    Do the images have a fixed upper bound as to their height?

    If so you can set the line-height of the containing div to that height, and then set vertical-align property of the img tags to middle.

    See here: http://phrogz.net/CSS/vertical-align/index.html

提交回复
热议问题