【问题标题】:CSS making text align left and justify at same timeCSS使文本左对齐并同时对齐
【发布时间】:2017-04-06 19:57:28
【问题描述】:

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

【问题讨论】:

  • 同时对齐和左对齐的文本会是什么样子?它与正确对齐的文本有何不同?它与未左对齐的文本有何不同?
  • 我想让 css 文本左对齐并同时对齐。这可能吗?
  • 我们无法理解您所说的“同时左对齐”是什么意思。您能否发布一张图片,展示您期望的外观?
  • 我认为您不明白“证明”是什么意思。 “对齐”文本左右对齐,因此说您想要左对齐是零意义。

标签: html css text text-align


【解决方案1】:

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

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

【讨论】:

  • 这应该是正确答案,不知道text-align-last属性
【解决方案2】:

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

左对齐:

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.

也许您正在尝试实现其他类型的对齐?

【讨论】:

    【解决方案3】:

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

    所以...

    左对齐

    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

    【讨论】:

    • 你是对的,你不能用 css 做到这一点,但你的差异示例非常清楚。这应该是正确答案
    【解决方案4】:

    两端对齐的文本总是“左右对齐”。

    【讨论】:

      【解决方案5】:

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

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

      在最新版本的 Chrome 和 IE 中,您会得到对齐的文本,最后一行使用该 css 左对齐。我不确定旧版浏览器如何处理它。

      您在 Photoshop 中获得 4 种类型的对齐文本,完全对齐或最后一行左对齐、居中或右对齐,但浏览器似乎只支持左对齐。对于从右到左的语言,它们可能具有右对齐文本。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2019-01-21
        • 2015-02-12
        • 1970-01-01
        • 1970-01-01
        • 2020-01-03
        • 2020-12-19
        • 2021-09-03
        • 1970-01-01
        相关资源
        最近更新 更多