Text align vertical within li

前端 未结 5 801
予麋鹿
予麋鹿 2021-01-25 01:08
  • Catalogue
相关标签:
5条回答
  • 2021-01-25 01:23

    I think you are looking for vertical-align.

    http://www.w3schools.com/cssref/pr_pos_vertical-align.asp

    0 讨论(0)
  • 2021-01-25 01:28

    Set the same height and line-height. This will do the trick.

    0 讨论(0)
  • 2021-01-25 01:30
    li img { vertical-align: middle; }
    
    0 讨论(0)
  • 2021-01-25 01:46

    Demo jsBin

      ul li{
        list-style:none;
        display:inline-block;
        height:40px;
        line-height:40px;
      }
      li img{
        float:left;
        margin:5px;
      }
    

    You need to set a height and same line-height for your li element;
    for the containing images - set float : left

    0 讨论(0)
  • 2021-01-25 01:46

    To align text and image, you can use margin-bottom:-5px on image element, the number depends on the size of your image.

    0 讨论(0)
提交回复
热议问题