CSS vertical alignment text inside li

前端 未结 9 1539
甜味超标
甜味超标 2020-12-07 19:59

I am displaying number of boxes in a row with fix height and width, generated from

  • tags. now I need to align the text in the vertical center. The CSS vertical-a
  • 9条回答
    •  孤街浪徒
      2020-12-07 20:06

      line-height is how you vertically align text. It is pretty standard and I don't consider it a "hack". Just add line-height: 100px to your ul.catBlock li and it will be fine.

      In this case you may have to add it to ul.catBlock li a instead since all of the text inside the li is also inside of an a. I have seen some weird things happen when you do this, so try both and see which one works.

    提交回复
    热议问题