How can I indent all text in a paragraph except the first line?

前端 未结 5 870
终归单人心
终归单人心 2020-12-11 02:53

This is an example fiddle.

What I\'m trying to do is indent everything after the first line.

Right now it looks like:

Categories: Aperiri 
nostr         


        
相关标签:
5条回答
  • 2020-12-11 03:45

    You can use the text-indent property with a negative value and compensate it with a left margin.

    For instance:

    .negative-indent {
        margin-left: 40px;
        text-indent: -40px;
    }
    

    Reference for text-indent property: MDN

    0 讨论(0)
  • 2020-12-11 03:53

    Use :first-line and text-indent tag. Put your whole text in one block (div or paragraph). Indent all lines and then set the first line to text-indent = 0

    Example:

    p { text-indent: -10px }
    p:first-line { text-indent: 0 }
    
    0 讨论(0)
  • 2020-12-11 03:53

    I found it best to use a simple solution like this:

    p:nth-child(n+2){text-indent: 3px;}
    
    0 讨论(0)
  • 2020-12-11 03:55

    I had the same problem. The answers published here until now gave me a bad result (letters were overlapping each other) when complex layout (eg tables) was present in the paragraph being undented.

    After much trying I found that the following didn't mess with these.

    text-indent: 0.5em hanging;
    

    Only tried it in Chrome.

    0 讨论(0)
  • 2020-12-11 03:58

    How about this:

    .hClass p{
        padding-left: 20px;
    }
    
    
    .iClass{
        font-style: oblinque;
        color: rgb(136, 136, 136);
        font-family: Arial,Liberation Sans,DejaVu Sans,sans-serif;
        margin-left: -20px;
    }
    

    See: http://jsfiddle.net/gVJK8/5/

    0 讨论(0)
提交回复
热议问题