【问题标题】:Css word wrap with style [duplicate]带有样式的CSS自动换行[重复]
【发布时间】:2018-09-08 01:35:45
【问题描述】:

我想用空格显示第二行换行。

输出:

 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

预期输出:

   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

我的代码:

<style>p{
 overflow:word-wrap;
}</style>
  <p> 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</p>

提前致谢。

【问题讨论】:

    标签: html css


    【解决方案1】:

    这很容易处理。诀窍是添加一点填充,然后用负值实际“缩进”第一行。有点跳出框框思考。

    p {
        padding-left: 2em;
        text-indent:-2em;
    }
    <p>
     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
    </p>

    【讨论】:

    • 不错的把戏。为此 +1。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-21
    • 1970-01-01
    • 2013-12-04
    • 1970-01-01
    • 2010-11-06
    • 1970-01-01
    相关资源
    最近更新 更多