CSS to vertically align text to middle of div

前端 未结 6 1994
清酒与你
清酒与你 2021-02-13 14:11

What is the correct way to force text in a div to vertically align to the middle? I have found a couple \'tricks\', but I need something that works with a single line and multip

6条回答
  •  悲哀的现实
    2021-02-13 14:14

    http://jsfiddle.net/DawFy/16/

    .header {
    
    display: block;    
    text-align: center;
        width: 123px;
    background: green;
    border-radius: 4px 4px 4px 4px;
    height: 80px;
    margin:0px auto;
    
    
    }
    li
     {
    list-style-type:none;
    
     }
    
    
  • test1
  • some text that will wrap
  • test3
  • Try this dont know if its "correct" but works

提交回复
热议问题