Css词包装与风格

时间:2018-03-29 07:22:20

标签: html css html5 css3

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

输出:

 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>

提前致谢。

1 个答案:

答案 0 :(得分:7)

这很容易处理。诀窍是添加一点填充,然后实际上&#34;缩进&#34;第一行带负值。在盒子外面思考。

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