http://stackoverflow.com/questions/7273338/how-to-vertically-align-an-image-inside-div

How it works:

  1. When you have two inline-block elements near each other, you can align each to other's side, so with vertical-align: middle you'll get something like this:

    Div 内部所有元素 全部垂直对齐

  2. When you have a block with fixed height (in px, em or other absolute unit), you can set the height of inner blocks in %.

  3. So, adding one inline-block with height: 100% in a block with fixed height would align another inline-block element in it (<img/> in your case) vertically near it.

  div内部所有元素都添加vertical-align: middle; display:inline-block

相关文章:

  • 2021-11-12
  • 2021-11-27
  • 2022-02-23
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2022-02-20
  • 2022-01-28
  • 2021-05-26
  • 2021-12-30
  • 2022-12-23
  • 2022-03-07
相关资源
相似解决方案