search

Home  >  Q&A  >  body text

css - text-align:center; 当多行时如何left对齐??

当文字多行时,且最后一行文字不足一铺满整个宽度. 则文字会居中对齐
"

 xxxxxxxx
 xxxxxxxx
    xx
    "
    
    好比上面这样..
    
    这样的话要如何解决,让他left对齐
伊谢尔伦伊谢尔伦2778 days ago592

reply all(2)I'll reply

  • 黄舟

    黄舟2017-04-17 11:25:35

    The problem is that now you can’t guarantee that the length of the above two lines is the same, in Chinese or the same. In English, some letters in different fonts have different widths.

    <p style="text-align:center"> <!--你原本的 p -->
       <p style="max-width:需要换行的宽度;text-align:left;display:inline-block"> 
    <!-- max-width  dislay:inline-block低版本ie可能不支持 -->
         文字,文字,文字
       </p>
    </p>

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:25:35

    text-align: left;

    reply
    0
  • Cancelreply