CSS使文本左对齐并同时对齐

时间:2012-07-02 02:12:30

标签: html css css3 text text-align

有没有办法让文本左对齐并且同时对齐?意思是左对齐。有没有办法实现这个目标?谢谢你的帮助。

5 个答案:

答案 0 :(得分:12)

您可能正在为最后一行寻找左对齐:

  text-align: justify;
  text-align-last: left;

答案 1 :(得分:8)

左对齐意味着文本的左边缘已对齐。对齐文本意味着文本的左边缘和右边缘都是对齐的。所以“左对齐和对齐”与“合理”没有什么不同,所以你的问题对我们没有任何意义。

左对齐:

Four-score and seven years ago, our fathers 
brought forth on this continent a new nation, 
conceived in liberty, and dedicated to the 
proposition that all men are created equal.

有道理:

Four-score  and  seven years  ago, our fathers 
brought forth on this continent a  new nation, 
conceived  in  liberty, and  dedicated to  the 
proposition that all men are created equal.

右对齐:

  Four-score and seven years ago, our fathers 
brought forth on this continent a new nation, 
   conceived in liberty, and dedicated to the 
  proposition that all men are created equal.

也许您正试图实现其他一些对齐方式?

答案 2 :(得分:7)

对齐意味着文本在两条边上排列。但是,文本的最后一行仍将位于左侧或右侧。

因此...

<强>左对齐

Lorem Ipsum is simply dummy text of the printing and       |
typesetting industry. Lorem Ipsum has been the industry's  |
standard dummy text ever since the 1500s, when an unknown  |
printer took a galley of type and scrambled it to make a   |
type specimen book.                                        |

<强>左对齐

                                                           |
Lorem  Ipsum  is  simply  dummy  text  of  the printing  and 
typesetting  industry. Lorem  Ipsum has been  the industry's 
standard dummy  text ever since  the 1500s, when  an unknown 
printer took  a galley of type  and scrambled  it to make  a 
type specimen book.                                        |
                                                           |

<强>右对齐

                                                           |
Lorem  Ipsum  is  simply  dummy  text  of  the printing  and 
typesetting  industry. Lorem  Ipsum has been  the industry's 
standard dummy  text ever since  the 1500s, when  an unknown 
printer took  a galley of type  and scrambled  it to make  a 
                                         type specimen book.
                                                           |

我过去没有使用过这个,所以我不能100%确定你是否支持CSS所支持的特定行为。我认为W3Schools的这个链接会有所帮助,但是:http://www.w3schools.com/cssref/css3_pr_text-justify.asp

答案 3 :(得分:3)

合理的文字总是&#34;左右对齐&#34;。

答案 4 :(得分:2)

这是一张图片,它左对齐(左上)和对齐(右上)文字。

enter image description here

要获得左对齐文本,您可以在css中使用text-align: justify;

在Chrome和IE的最新版本中,您可以获得对齐文本,最后一行使用该css保持对齐。我不确定旧浏览器的处理方式。

Photoshop中有4种类型的对齐文本,完全对齐或最后一行是左对齐,居中对齐或右对齐,但浏览器似乎只支持左对齐。对于从右到左的语言,他们可能有正确的文本。