Indent starting from the second line of a paragraph with CSS

后端 未结 6 1178
轻奢々
轻奢々 2020-12-07 13:34

How can I indent starting from the second line of a paragraph?

I\'ve tried

p {
    text-indent: 200px;
}
p:first-line {
    text-indent: 0;
}
         


        
6条回答
  •  时光取名叫无心
    2020-12-07 14:21

    Is it literally just the second line you want to indent, or is it from the second line (ie. a hanging indent)?

    If it is the latter, something along the lines of this JSFiddle would be appropriate.

        div {
            padding-left: 1.5em;
            text-indent:-1.5em;
        }
        
        span {
            padding-left: 1.5em;
            text-indent:-1.5em;
        }
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

    This example shows how using the same CSS syntax in a DIV or SPAN produce different effects.

提交回复
热议问题